Skip to content

SYSENG-1779: update GoReleaser to latest version #36

SYSENG-1779: update GoReleaser to latest version

SYSENG-1779: update GoReleaser to latest version #36

Workflow file for this run

# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- 'v*'
# To test GoReleaser workflows, we also run the release workflow on Pull Requests.
# However, GoReleaser will run in dry-mode, so no actual releases are made.
pull_request:
paths:
- '.github/workflows/release.yml'
- '.goreleaser.yml'
env:
GO_VERSION: 1.21
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{env.GO_VERSION}}
- name: Import GPG key
id: import_gpg
uses: paultyng/ghaction-import-gpg@v2.1.0
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
# Although we don't publish as part of the GoReleaser workflow, the validation step is
# kept as close to the documentation as possible to prevent surprises in the future.
- name: Run GoReleaser (dry-run)
uses: goreleaser/goreleaser-action@v6
if: "${{ startsWith(github.event_name, 'pull_request') }}"
with:
args: release --skip=publish --clean --auto-snapshot
version: "~> v2"
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
args: release --clean
version: "~> v2"
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}