-
Notifications
You must be signed in to change notification settings - Fork 23
53 lines (50 loc) · 1.53 KB
/
goreleaser.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 }}