GitHub Actions GoReleaser CI/CD Setup
This guide will show you how to direct goreleaser to use the versions and release notes from Bumper.
name: Release
on: workflow_dispatch: push: branches: - main paths: [.bumper/versions.toml]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs: release-cli: runs-on: ubuntu-latest permissions: # So we can push tags contents: write
steps: - name: Checkout repository uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 with: fetch-depth: 0
- name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
- name: Read version and release note from Bumper run: | bumper_version="$(mise bumper current)" echo "GORELEASER_CURRENT_TAG=v$bumper_version" >> $GITHUB_ENV
notes_file="$(mktemp)" echo "RELEASE_NOTES_FILE=$notes_file" >> $GITHUB_ENV mise bumper cat --version "$bumper_version" > "$notes_file"
# GoReleaser works off of git tags, so we need to create and push a tag # for the version we got from Bumper - name: Create and push tag run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag "${GORELEASER_CURRENT_TAG}" git push origin "${GORELEASER_CURRENT_TAG}"
- name: Run GoReleaser uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: version: "~> v2" args: release --clean