Repository navigation
Set the version from the git tag at build time - #315
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
version.goheld a fixed version. Each release needed a manual edit of this file. When the edit was missed, the release build used the old version. For example, Docker images were pushed with the old tag.Change
Versionfrom aconstto avarwith the default valuedev.Versionfrom the git tag with-ldflags "-X github.com/moov-io/metro2.Version=..."in everygo buildcommand in the makefile.VERSIONfrom the environment, or fromgit describe --tags --abbrev=0. Usedevwhen no tag exists.VERSIONas a build argument to the Docker builds, and use it in the Dockerfiles.VERSIONfrom the tag in the release workflow.git tag -fline frommake release. It moved an existing tag.A release now needs only a tag. Nobody edits
version.go.Test
make build VERSION=v8.8.8builds a binary that reportsv8.8.8.go test ./...passes.