-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (65 loc) · 2.23 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: goreleaser
on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3xx`
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Derive release suffix from tag (if it exists)
run: |
# Extract suffix from tag name after the last '-' (e.g., 'dencun' from 'v1.0.0-dencun')
RELEASE_SUFFIX=${GITHUB_REF##*-}
# Check if we are dealing with a pure version (no suffix)
if [[ $RELEASE_SUFFIX == v* ]]; then
RELEASE_SUFFIX=""
fi
echo "RELEASE_SUFFIX=$RELEASE_SUFFIX" >> $GITHUB_ENV
echo "Release suffix: $RELEASE_SUFFIX"
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Install cross-compiler for linux/arm64
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Context for Buildx
shell: bash
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update GoReleaser config
run: |
cp .goreleaser.yaml ../.goreleaser.yaml.new
# If we have a RELEASE_SUFFIX, update the goreleaser config to not set
# the release as the latest
if [[ -n "$RELEASE_SUFFIX" ]]; then
echo "release:" >> ../.goreleaser.yaml.new
echo " prerelease: true" >> ../.goreleaser.yaml.new
echo " make_latest: false" >> ../.goreleaser.yaml.new
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean --config ../.goreleaser.yaml.new
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_SUFFIX: ${{ env.RELEASE_SUFFIX }}