Skip to content

Commit

Permalink
dynamic version, fix module
Browse files Browse the repository at this point in the history
  • Loading branch information
rostrovsky committed Oct 31, 2023
1 parent 2f9622d commit 777a9af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@ jobs:
LINUX_AMD_ARCHIVE: sodium-${{ steps.branch.outputs.ref }}-linux-amd64.tar.gz
LINUX_ARM_ARCHIVE: sodium-${{ steps.branch.outputs.ref }}-linux-arm.tar.gz
WIN_AMD_ARCHIVE: sodium-${{ steps.branch.outputs.ref }}-win-amd64.zip
BIN_VERSION: ${{ steps.branch.outputs.ref }}
run: |
echo "Building Linux amd64 binary"
GOOS=linux GOARCH=amd64 go build -o na
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$BIN_VERSION" -o na
tar -czvf ${LINUX_AMD_ARCHIVE} na
rm -v na
echo "Building Linux ARM binary"
GOOS=linux GOARCH=arm go build -o na
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=$BIN_VERSION" -o na
tar -czvf ${LINUX_ARM_ARCHIVE} na
rm -v na
echo "Building Windows amd64 binary"
GOOS=windows GOARCH=amd64 go build -o na.exe
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=$BIN_VERSION" -o na.exe
zip ${WIN_AMD_ARCHIVE} na.exe
rm -v na.exe
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module rostrovsky/sodium
module github.com/rostrovsky/sodium

go 1.21.3
go 1.21.0

require (
github.com/spf13/cobra v1.7.0
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

var logger *slog.Logger
var version = "<< set by build >>"

type CommandConfig struct {
Info string `yaml:"_info"`
Expand All @@ -22,7 +23,7 @@ type CommandConfig struct {
var rootCmd = &cobra.Command{
Use: "na",
Short: "Dynamically builds CLI based on a YAML config",
Version: "0.1.0",
Version: version,
}

func init() {
Expand Down

0 comments on commit 777a9af

Please sign in to comment.