-
Notifications
You must be signed in to change notification settings - Fork 413
87 lines (76 loc) · 2.2 KB
/
tag-and-release.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Create new Git tag
on:
push:
branches:
- master
permissions:
contents: write
jobs:
tag:
runs-on: ubuntu-latest
outputs:
tag_result: ${{ steps.tag.outputs.tag_result }}
steps:
- run: sudo apt update && sudo apt install -y git && git --version
- uses: actions/checkout@v2
with:
# We need entire history of tags
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./tools/go.mod
check-latest: true
cache-dependency-path: "**/*.sum"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tagging commands
id: tag
run: |
set +e
task -x tag
tag_result="$?"
echo "tag_result=$tag_result" >> $GITHUB_OUTPUT
# The range between 8 and 63 inclusive is reserved for custom
# error codes that contain specific meaning.
if [ $tag_result -lt 8 -o $tag_result -gt 63 ]; then
exit $tag_result
fi
exit 0
- name: Push tags
run: task tag.push
if: steps.tag.outputs.tag_result == 0
release:
needs: tag
if: needs.tag.outputs.tag_result == 0
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: GoReleaser
uses: goreleaser/[email protected]
with:
args: release --rm-dist
version: "<2"
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.GORELEASER_HOMEBREW_TAP_TOKEN }}