All you need to do is add one release.yml
file to your Github repository. I am flabbergasted with the UX of Github Actions! There are many templates you can use, but I decided to use the following one:
name: Release TBB binaries on: release: types: [created] jobs: releases-matrix: name: Release Go Binary runs-on: ubuntu-latest strategy: matrix: # build and publish in parallel: linux/amd64 goos: [linux] goarch: [amd64] steps: - uses: actions/checkout@v2 - name: Run tests run: go test -v -p=1 -timeout=0 ./... - uses: wangyoucao577/go-release-action@v1.16 with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} project_path: "./cmd/tbb" binary_name: "tbb" ldflags: "-s -w" extra_files: LICENSE Readme.md
goos: [linux, darwin, windows]
token, ssh-key, ref (branch/tag)
, and otherstbb
binary from ./cmd/tbb/main.go
fileldflags
settings into the binary build. Flag -s
omits the symbol table and debug information, and -w
strips the DWARF symbol table from the resulting binarytbb-1.8.6-alpha-linux-amd64.tar.gz
and packs the LICENSE
and Readme.md
inside it
Create a new .github/workflows
directory and paste the script there - adjust to your needs. You can also skip some steps like running the tests if you don't have them.
Full example: https://github.com/web3coach/the-blockchain-bar/blob/1.8.6-alpha/.github/workflows/release.yml
You click the Draft a new release from Github UI, give it a tag, name, described the changes and publish. The Github Actions workflow will take care of testing, building and attaching binaries to it.
You will find your generated binaries attached to the release when the build job finishes. Your Go program is ready to be downloaded by your users.
Hi, I am writing an eBook on how to build a peer-to-peer system in Go from scratch!
Follow how the main protagonist Andrej, a web developer by day and a bartender by night, learns real-world use of blockchain through the growth of his new business venture: "The Blockchain Bar".