GoReleaser #72
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GoReleaser | |
on: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: write # needed to update the data of a release | |
packages: write | |
jobs: | |
goreleaser: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
# The reason we don't use `go-version: go.mod` is because go.mod's | |
# version is the minimal required version. But for building the | |
# binaries, we want to use a Go version that is still supported. | |
go-version: "^1.21" | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser (PR) | |
uses: goreleaser/goreleaser-action@v4 | |
if: "!startsWith(github.ref, 'refs/tags')" # runs on a PR | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser (Publish Release) | |
uses: goreleaser/goreleaser-action@v4 | |
if: "startsWith(github.ref, 'refs/tags')" # runs on a Tag being pushed | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |