diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa5487c..6154e00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: with: go-version: ">=1.19.7" - name: Go Build - run: go build -o ssh-sync + run: go build -o ssh-sync -ldflags "-X main.version=${{github.ref_name}}" - name: Upload Artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8a06748..89f8f03 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: go-version: ">=1.19.7" - name: Go Build - run: go build -o ./win-build/ssh-sync.exe + run: go build -o ./win-build/ssh-sync.exe -ldflags "-X main.version=${{github.ref_name}}" shell: powershell - name: Inno Build diff --git a/main.go b/main.go index 05e8df6..26723b5 100644 --- a/main.go +++ b/main.go @@ -8,10 +8,12 @@ import ( "github.com/urfave/cli/v2" ) +var version string + func main() { app := &cli.App{ Name: "ssh-sync", - Version: "v0.2.4", + Version: version, Description: "Syncs your ssh keys to a remote server", Commands: []*cli.Command{ {