-
Notifications
You must be signed in to change notification settings - Fork 67
81 lines (79 loc) · 2.42 KB
/
build.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
name: Build
on:
push:
branches: [master]
tags: [v*]
permissions:
contents: write
jobs:
goreleaser:
name: Goreleaser
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache-dependency-path: |
go.sum
.goreleaser.yaml
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: ${{ contains(github.ref, 'v') }}
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test GoReleaser
uses: goreleaser/goreleaser-action@v6
if: ${{ ! contains(github.ref, 'v') }}
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --snapshot --clean
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: go-judge
path: dist/
upload-artifacts:
name: Upload artifacts-${{ matrix.os }}-${{ matrix.arch }}
runs-on: ubuntu-latest
needs: goreleaser
strategy:
matrix:
os:
- windows
- linux
- darwin
arch:
- amd64_v3
- arm64_v8.0
steps:
- uses: actions/download-artifact@v4
with:
name: go-judge
path: dist
- name: Upload assets go-judge
uses: actions/upload-artifact@v4
with:
name: go-judge_${{ matrix.os == 'darwin' && 'macos' || matrix.os }}_${{ matrix.arch }}
path: dist/go-judge_${{ matrix.os }}_${{ matrix.arch }}/go-judge${{ matrix.os == 'windows' && '.exe' || ''}}
- name: Upload assets go-judge-shell
uses: actions/upload-artifact@v4
with:
name: go-judge-shell_${{ matrix.os == 'darwin' && 'macos' || matrix.os }}_${{ matrix.arch }}
path: dist/go-judge-shell_${{ matrix.os }}_${{ matrix.arch }}/go-judge-shell${{ matrix.os == 'windows' && '.exe' || ''}}