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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0
- name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.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@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 with: version: "~> v2" args: release --clean --release-notes=${{ env.RELEASE_NOTES_FILE }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Keep the changelog pipe enabled
Section titled “Keep the changelog pipe enabled”GoReleaser loads the --release-notes file in its changelog pipe. Keep that
pipe enabled in .goreleaser.yaml:
# Release notes come from Bumper (--release-notes in the workflow), which# replaces git-log changelog generation.changelog: disable: false