Go Release!
A simple program to handle GitHub releases for Go repositories.
Get
go get github.com/nwillc/gorelease
go install
Setup
Your repository should contain the following:
.version
LICENSE.md
version/version.go
Your Semantic Version
The .version
file should contain the semantic version you want to use, for example 0.1.0
.
Your Code License
This file is optional, if present the text in this file will be used as a comment for the version.go
files generated.
Your version.go File
This can be empty to start, gorelease
will create a valid Go file basically containing:
package version
const Version = "v0.1.0"
This can be referenced in your Go as version.Version
. The output target for this can be changed on the command line.
Use
Assuming you've set up as above.
- Commit your code in preparation for release.
- Update the
.version
file with a new version number.
- Run
gorelease
, or use a //go:generate gorelease
in your code and go generate
to run it.
This will:
- generate a new
version/version.go
- Create a tag with the version, prepended by a
v
- push the tag
- push the repository
If the push fails due to credential issues it will inform you how to do the push manually.
Options
Usage of ./gorelease:
-dirty
Allow dirty repository with uncommitted files.
-dryrun
Perform a dry run, no files changed or tags/files pushed.
-output string
Where to put the output version.go file (default "version/version.go")
-version
Display version.