-
Notifications
You must be signed in to change notification settings - Fork 18
97 lines (81 loc) · 2.72 KB
/
goreleaser.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
88
89
90
91
92
93
94
95
96
97
name: goreleaser
# ref. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
release:
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
strategy:
matrix:
job:
# use ubuntu20.04 as default one, for backward compatibility
- os: ubuntu-20.04
platform: linux
target: linux_amd64
- os: ubuntu-20.04
platform: linux
target: linux_amd64
goreleaser_suffix: _ubuntu20.04
- os: ubuntu-22.04
platform: linux
target: linux_amd64
goreleaser_suffix: _ubuntu22.04
- os: ubuntu-24.04
platform: linux
target: linux_amd64
goreleaser_suffix: _ubuntu24.04
- os: macos-latest
platform: darwin
target: darwin_amd64
- os: macos-latest
platform: darwin
target: darwin_arm64
name: Release ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install OS dependencies
shell: bash
run: |
case ${{ matrix.job.target }} in
linux_arm64) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Show version information
shell: bash
run: |
gcc --version || true
go version
# https://github.com/goreleaser/goreleaser-action
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --config .goreleaser_${{ matrix.job.target }}${{ matrix.job.goreleaser_suffix }}.yaml
workdir: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get tag version
if: startsWith(github.ref, 'refs/tags/')
id: get_tag_version
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
- name: Release latest
uses: softprops/action-gh-release@v1
if: ${{ github.ref == 'refs/heads/main' }}
with:
name: Latest release
tag_name: latest
draft: false
prerelease: false
body: Latest builds from the last commit
files: |
./dist/gpud_v${{steps.get_tag_version.outputs.TAG_VERSION}}_${{ matrix.job.target }}${{ matrix.job.goreleaser_suffix }}.tgz