Skip to content

Commit

Permalink
Add tag as version number
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Apr 24, 2024
1 parent 53ee9b9 commit d4116ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ jobs:
echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
- name: Build Binary (amd64)
run: |
GOARCH=amd64 go build -ldflags "-s -w" -o "${{ github.workspace }}/release/fixctl-$OS_NAME-amd64-${{ github.ref_name }}$SUFFIX"
GOARCH=amd64 go build -ldflags "-s -w -X main.version=v${{ github.ref_name }}" -o "${{ github.workspace }}/release/fixctl-$OS_NAME-amd64-${{ github.ref_name }}$SUFFIX"
shell: bash
- name: Build Binary (arm64)
run: |
GOARCH=arm64 go build -ldflags "-s -w" -o "${{ github.workspace }}/release/fixctl-$OS_NAME-arm64-${{ github.ref_name }}$SUFFIX"
GOARCH=arm64 go build -ldflags "-s -w -X main.version=v${{ github.ref_name }}" -o "${{ github.workspace }}/release/fixctl-$OS_NAME-arm64-${{ github.ref_name }}$SUFFIX"
shell: bash
- name: Generate Universal Binary (macOS)
if: matrix.os == 'macos-latest'
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
"github.com/someengineering/fixctl/utils"
)

var version = "development"

func customUsage() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s (%s):\n", os.Args[0], version)
flag.VisitAll(func(f *flag.Flag) {
fmt.Fprintf(flag.CommandLine.Output(), " --%s: %s (default %q)\n", f.Name, f.Usage, f.DefValue)
})
Expand Down

0 comments on commit d4116ba

Please sign in to comment.