-
Notifications
You must be signed in to change notification settings - Fork 203
133 lines (126 loc) · 3.61 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release suo5
on:
push:
branches:
- 'release**'
- 'main'
release:
types: [ published ]
permissions:
contents: read
jobs:
build-binary:
name: Build cli
strategy:
fail-fast: true
matrix:
include:
- os: windows
arch: amd64
output: suo5-windows-amd64.exe
- os: darwin
arch: amd64
output: suo5-darwin-amd64
- os: darwin
arch: arm64
output: suo5-darwin-arm64
- os: linux
arch: amd64
output: suo5-linux-amd64
- os: linux
arch: arm64
output: suo5-linux-arm64
runs-on: ubuntu-latest
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- run: go build -trimpath -ldflags "-w -s -extldflags '-static' -X main.Version=${{ github.ref_name }}" -o target/${{ matrix.output }}
- uses: actions/upload-artifact@v3
with:
name: target
path: target/*
build-gui:
name: Build gui
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: windows/amd64
output: suo5-gui-windows.exe
- os: macos-latest
platform: darwin/universal
# wails bug, mac 的 output file 不生效, 先用这个保证能用
output: suo5
- os: ubuntu-latest
platform: linux/amd64
output: suo5-gui-linux
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
- name: Bump manifest version
if: startsWith(github.ref, 'refs/tags/')
working-directory: gui
run: node version.js ${{ github.ref_name }}
- run: npm install && npm run build
working-directory: gui/frontend
- uses: dAppServer/[email protected]
with:
build-name: ${{ matrix.output }}
build-platform: ${{ matrix.platform }}
app-working-directory: gui
go-version: '1.20'
package: false
- if: runner.os == 'macOS'
shell: bash
working-directory: gui
run: |
rm -rf ./build/bin/${{ matrix.output }}.app.zip
ditto -c -k --keepParent ./build/bin/${{matrix.output}}.app ./build/bin/${{matrix.output}}.app.zip
rm -rf ./build/bin/${{ matrix.output }}.app
- uses: actions/upload-artifact@v3
with:
name: target
path: gui/build/bin/*
collect-release:
name: Collect and release
needs: [ build-binary, build-gui ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: target
path: target
- run: ls -al target && ls -R target/
- working-directory: target
run: |
rm -rf suo5-amd64-installer.exe
rm -rf suo5.pkg
mv suo5.app.zip suo5-gui-darwin.app.zip
- run: ls -al target && ls -R target/ && file target/
- uses: actions/upload-artifact@v3
with:
name: target-release
path: target/*
# release assets
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/*