Skip to content

Commit

Permalink
feat: tag version in build
Browse files Browse the repository at this point in the history
  • Loading branch information
tomschlick committed Mar 23, 2024
1 parent 56a5c4f commit 3b056b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
goarch: ${{ matrix.goarch }}
md5sum: OFF
compress_assets: OFF
ldflags: "-X main.version=${{ github.event.release.tag_name }} -X main.commit=${{ github.sha }}"

package:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,9 +66,6 @@ jobs:
cd ..
) >> $GITHUB_ENV
- name: Set the VERSION
run: sed -i 's/VERSION=/VERSION=${{ env.VERSION }}/' REPO/etc/pkgs-observer-agent.conf.d/service.conf && cat REPO/etc/pkgs-observer-agent.conf.d/service.conf

- name: Make Directory Structure
run: mkdir -p "SOURCES/${GITHUB_REPO_NAME}" SPECS release

Expand Down
3 changes: 1 addition & 2 deletions etc/pkgs-observer-agent.conf.d/service.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
INGEST_ENDPOINT=
VERSION=
INGEST_ENDPOINT=
8 changes: 2 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"runtime"
)

var version = "unknown"

type Package struct {
RawLine string `json:"raw"`
}
Expand Down Expand Up @@ -178,12 +180,6 @@ func main() {
return
}

version := os.Getenv("VERSION")
if version == "" {
fmt.Println("Error: VERSION environment variable not set")
return
}

payload := Payload{
Version: version,
Hostname: hostname,
Expand Down

0 comments on commit 3b056b3

Please sign in to comment.