-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (69 loc) · 2.14 KB
/
release_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
82
83
84
name: goreleaser
on:
push:
tags:
- "*" # 打标签时构建
permissions:
contents: write
jobs:
release-linux-binary:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install cross-compiler for linux/arm64
run: sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set up git tag
uses: devops-actions/[email protected]
with:
strip_v: false
- name: Replace __VERSION__ in cmds/root.go
run: sed -i "s/__VERSION__/${{ steps.get_tag.outputs.tag }}/" cmds/root.go && cat cmds/root.go
- name: Set up Go
uses: actions/setup-go@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --skip=validate --config .github/workflows/.goreleaser-for-linux.yml
env:
GITHUB_TOKEN: ${{ secrets.GO_BUILD_TOKEN}}
- name: Upload assets
uses: actions/upload-artifact@v3
with:
name: myapp
path: dist/*
release-darwin-binary:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.23.1 # 指定 Go 版本
- name: Set up git tag
uses: devops-actions/[email protected]
with:
strip_v: false
- name: Replace __VERSION__ in cmds/root.go
run: sed -i '' "s/__VERSION__/${{ steps.get_tag.outputs.tag }}/" cmds/root.go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --skip=validate --config .github/workflows/.goreleaser-for-darwin.yml
env:
GITHUB_TOKEN: ${{ secrets.GO_BUILD_TOKEN}}
- name: Upload assets
uses: actions/upload-artifact@v3
with:
name: myapp
path: dist/*