-
-
Notifications
You must be signed in to change notification settings - Fork 21
92 lines (92 loc) · 2.49 KB
/
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
88
89
90
91
92
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.matrix.outputs.versions }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate matrix
id: matrix
working-directory: ${{ github.workspace }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
versions=$(make matrix)
echo $versions
echo "versions=$versions" >> $GITHUB_OUTPUT
build:
needs: matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ${{ fromJson(needs.matrix.outputs.go-version) }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
working-directory: ${{ github.workspace }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: GO_VERSION=${{ matrix.go-version }} make build/ci
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.go-version }}
path: ${{ github.workspace }}/dist/
goreleaser:
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: go/src/github.com/${{ github.repository }}
- uses: actions/download-artifact@v4
with:
path: ./go/src/github.com/${{ github.repository }}/dist/
- name: Move artifacts
working-directory: ./go/src/github.com/${{ github.repository }}
run: |
set -eu
mkdir ./assets/
cat ./dist/**/*_checksums.txt > ./assets/checksums.txt
mv ./dist/**/*.tar.gz ./assets/
ls ./assets/
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean -f ./scripts/cross-build/.goreleaser.yml
workdir: ./go/src/github.com/${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}