-
Notifications
You must be signed in to change notification settings - Fork 29
149 lines (128 loc) · 4.51 KB
/
build.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Wails build
on:
release:
types: [ created ]
env:
NODE_OPTIONS: "--max-old-space-size=4096"
APP_NAME: 'Kafka-King'
APP_WORKING_DIRECTORY: 'app'
GO_VERSION: '1.24'
NODE_VERSION: "20.x"
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
jobs:
build-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest] # amd64/x64
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install 7-Zip
run: choco install 7zip
- name: GoLang
uses: actions/setup-go@v4
with:
check-latest: true
go-version: ${{ env.GO_VERSION }}
- name: NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build & Compress
shell: pwsh # 确保使用 PowerShell
run: |
$ARCH = $env:PROCESSOR_ARCHITECTURE.ToLower()
go install github.com/wailsapp/wails/v2/cmd/wails@latest
cd ${{ env.APP_WORKING_DIRECTORY }}
wails build -ldflags="-X 'app/backend/common.Version=${{ github.ref_name }}'" -o ${{ env.APP_NAME }}.exe
cd ..
copy readme.md app\build\bin\
copy LICENSE app\build\bin\
& "C:\Program Files\7-Zip\7z.exe" a -t7z "${{ env.APP_NAME }}-${{ github.ref_name }}.windows.$ARCH.7z" ".\app\build\bin\*" -r
- name: Upload
uses: softprops/action-gh-release@v1
with:
files: "*.7z"
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest] # macos-13是amd64,macos-latest是m1芯片
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: GoLang
uses: actions/setup-go@v4
with:
check-latest: true
go-version: ${{ env.GO_VERSION }}
- name: NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build & Compress
run: |
ARCH=$(uname -m)
go install github.com/wailsapp/wails/v2/cmd/wails@latest
brew install mitchellh/gon/gon
cd ${{ env.APP_WORKING_DIRECTORY }}
wails build -ldflags "-X 'app/backend/common.Version=${{ github.ref_name }}'" -platform darwin/universal -o ${{ env.APP_NAME }}
chmod +x build/bin/*/Contents/MacOS/*
ditto -c -k --keepParent ./build/bin/${{ env.APP_NAME }}.app ./build/bin/${{ env.APP_NAME }}-${{ github.ref_name }}.macos.universal.app.zip
- name: Upload
uses: softprops/action-gh-release@v1
with:
files: ${{ env.APP_WORKING_DIRECTORY }}/build/bin/*.zip
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: GoLang
uses: actions/setup-go@v4
with:
check-latest: true
go-version: ${{ env.GO_VERSION }}
- name: NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build & Compress
run: |
ARCH=$(uname -m)
go install github.com/wailsapp/wails/v2/cmd/wails@latest
sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
cd ${{ env.APP_WORKING_DIRECTORY }}
wails build -ldflags="-X 'app/backend/common.Version=${{ github.ref_name }}'" -o ${{ env.APP_NAME }}
cd ..
mkdir _temp_dist
cp readme.md _temp_dist/
cp LICENSE _temp_dist/
cp -r ${{ env.APP_WORKING_DIRECTORY }}/build/bin/* _temp_dist/
chmod +x _temp_dist/*
cd _temp_dist/
tar -zcvf ${{ env.APP_NAME }}-${{ github.ref_name }}.ubuntu.$ARCH.tar.gz *
mv ${{ env.APP_NAME }}-${{ github.ref_name }}.ubuntu.$ARCH.tar.gz ..
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: "*.tar.gz"
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}