deploy.sh is a shell wrapper based on Go binaries to automate deployment of new release to github, using the github
API.
It is originaly build to push pre-built binaries of my golang opensource project to github releases.
This tool is for developper, you will need a Go workspace.
The scripts is working on my environment
We provide a deploy script, which will take the last git tag, and a deployment
message written in a yaml file deployment.yml.
So you need to create the release text in deployment.yml before you run
deploy.sh.
See what will going on (dry-run):
./deploy.sh deploy -n
Deploy and replace existing binaries for this release.
./deploy.sh deploy --replace
Only build binaries in build/ dir:
./deploy.sh build
In order to release binaries you will need some granted access to github API.
You will also need some more developper tools.
Most of the tools require a working Go developper environment. Which should not be too complicated to setup.
All dependancies are installed in your Go workspace with:
make install_builddep
Go for the details:
A shell command-line parser for making beautiful CLI with ease
go install github.com/docopt/docopts
Cross-compiled binaries are built with gox
go install github.com/mitchellh/gox
Version are embedded at compile time in Go with govvv
go install github.com/ahmetb/govvv
Releases are published to github releases using github API with github-release
go install github.com/github-release/github-release
You will need a valid gitub token for the target repository.
https://help.github.com/articles/creating-an-access-token-for-command-line-use
The token needs to have repos auth priviledges.
Export your GITHUB_TOKEN as a bash environment variable:
export GITHUB_TOKEN="your token here"
We use semantic verion tags
The current version is stored in the file VERSION which will be used by govvv.
echo "v0.6.3-alpha2" > VERSION
git tag -a "$(cat VERSION)" -m "golang 2019"
git push origin "$(cat VERSION)"
See: https://mikefarah.gitbook.io/yq/
For extracting yaml data from deployment.yml
go install github.com/mikefarah/yq/v4@latest
Our script uses docopts for parsing our command line option.
go get github.com/docopt/docopts
cd $GOPATH/src/github.com/docopt/docopts
make