Skip to content

Commit

Permalink
fix: version via generate and embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Roche committed Jun 2, 2022
1 parent d12a91d commit 34caea3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
# - go generate ./...
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import (
"os/exec"

"github.com/jeff-roche/biome/parser"

_ "embed"
)

var Version string
//go:generate bash -c "echo -n $VERSION > version.txt"
//go:embed version.txt
var version string

func main() {
vflag := flag.Bool("version", false, "display the release version of this tool")
Expand All @@ -20,7 +24,7 @@ func main() {

// If they specified -v, just print the version
if *vflag {
fmt.Println(Version)
fmt.Println(version)
return
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ then
git tag latest
git push --tags

export VERSION=$NEXT

# Do the release
VERSION=$NEXT goreleaser --rm-dist
goreleaser --rm-dist
else
echo "No new version detected. Skipping release."
fi

0 comments on commit 34caea3

Please sign in to comment.