-
-
Notifications
You must be signed in to change notification settings - Fork 3
312 lines (262 loc) · 10.2 KB
/
build-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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Build Release
permissions:
contents: write
actions: write
on:
release:
types: [created]
workflow_dispatch:
inputs:
release_url:
description: 'Release upload URL'
required: true
version:
description: 'Version tag'
required: true
jobs:
build-macos:
name: Build macOS
runs-on: macos-latest
environment: Prod
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.version }}
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Wails Dependencies
run: |
mkdir -p ../github
cd ../github
git clone https://github.com/ansxuman/wails.git
cd wails
git checkout start_on_login
cd v3/cmd/wails3
go install
cd ../../../..
- name: Update go.mod
run: |
sed -i '' 's|=> ../wails/v3|=> ../github/wails/v3|g' go.mod
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Build and Sign Release Binaries
run: |
mkdir -p darwinBinaries
wails3 doctor
# Update build assets
wails3 task common:update:build-assets
# Build the app package
task darwin:package:universal
# Store signing identity and version in variables
SIGN_IDENTITY="${{ secrets.APPLE_SIGNING_IDENTITY }}"
VERSION="${{ github.event.release.tag_name || inputs.version }}"
echo "Using version: $VERSION"
# Sign the binary
codesign --deep --force --verbose --options=runtime --sign "$SIGN_IDENTITY" bin/Clave.app/Contents/MacOS/Clave
# Sign the app bundle
codesign --deep --force --verbose --options=runtime --sign "$SIGN_IDENTITY" bin/Clave.app
# Create DMG
npm install --global create-dmg
cd bin
create-dmg Clave.app --dmg-title "Clave-${VERSION}"
# Process and sign DMG
# Move any .dmg file found to darwinBinaries with the correct name
for dmg in *.dmg; do
mv "$dmg" "../darwinBinaries/Clave-${VERSION}-universal.dmg"
break
done
echo "universalDMGPath=darwinBinaries/Clave-${VERSION}-universal.dmg" >> $GITHUB_ENV
cd ..
ls -alh darwinBinaries
- name: Notarize Release Binaries
run: |
xcrun notarytool submit ${{ env.universalDMGPath }} --apple-id ${{ secrets.MACOS_SIGNING_GON_USERNAME }} --team-id ${{secrets.APPLE_DEVELOPER_TEAM_ID}} --password ${{ secrets.MACOS_SIGNING_GON_APPLICATION_PASSWORD }} --verbose --wait
xcrun stapler staple ${{ env.universalDMGPath }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event_name == 'workflow_dispatch' && inputs.release_url || github.event.release.upload_url }}
asset_path: ${{ env.universalDMGPath }}
asset_name: Clave-${{ github.event.release.tag_name || inputs.version }}-universal.dmg
asset_content_type: application/x-apple-diskimage
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.version }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Wails Dependencies
shell: cmd
run: |
mkdir ..\github
cd ..\github
git clone https://github.com/ansxuman/wails.git
cd wails
git checkout start_on_login
cd v3\cmd\wails3
go install
cd ..\..\..\..
- name: Update go.mod
shell: pwsh
run: |
(Get-Content go.mod) -replace 'replace.*=> ../wails/v3', 'replace github.com/wailsapp/wails/v3 => ../github/wails/v3' | Set-Content go.mod
- name: Build Release Binaries
shell: pwsh
run: |
mkdir windowsBinaries
wails3 doctor
# Update build assets
wails3 task common:update:build-assets
# Build the app package
task package
$VERSION="${{ github.event.release.tag_name || inputs.version }}"
Move-Item -Path "bin\Clave-amd64-installer.exe" -Destination "windowsBinaries\Clave-Setup-${VERSION}-x64.exe"
echo "WINDOWS_INSTALLER_PATH=windowsBinaries/Clave-Setup-${VERSION}-x64.exe" >> $env:GITHUB_ENV
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event_name == 'workflow_dispatch' && inputs.release_url || github.event.release.upload_url }}
asset_path: ${{ env.WINDOWS_INSTALLER_PATH }}
asset_name: Clave-Setup-${{ github.event.release.tag_name || inputs.version }}-x64.exe
asset_content_type: application/vnd.microsoft.portable-executable
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.version }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev gcc libgtk-3-dev pkg-config
- name: Setup Wails Dependencies
run: |
mkdir -p ../github
cd ../github
git clone https://github.com/ansxuman/wails.git
cd wails
git checkout start_on_login
cd v3/cmd/wails3
go install
cd ../../../..
- name: Update go.mod
run: |
sed -i 's|=> ../wails/v3|=> ../github/wails/v3|g' go.mod
- name: Build Release Binaries
run: |
mkdir -p linuxAppImage
wails3 doctor
# Update build assets
wails3 task common:update:build-assets
# Build the app package
task package
VERSION="${{ github.event.release.tag_name || inputs.version }}"
mv bin/clave-x86_64.AppImage "linuxAppImage/clave_${VERSION}_amd64.AppImage"
echo "LINUX_APP_PATH=linuxAppImage/clave_${VERSION}_amd64.AppImage" >> $GITHUB_ENV
ls -alh linuxAppImage
- name: Build deb using dpkg
run: |
VERSION="${{ github.event.release.tag_name || inputs.version }}"
CLEAN_VERSION="${VERSION#v}"
mkdir linuxDeb
mkdir build_deb
cd build_deb
mkdir -p clave_${VERSION}_amd64/{DEBIAN,opt,usr,var}
cat > clave_${VERSION}_amd64/DEBIAN/control <<- EOF
Package: clave
Version: $CLEAN_VERSION
Section: net
Priority: optional
Architecture: amd64
Maintainer: Clave <[email protected]>
Description: A lightweight cross-platform desktop authenticator app.
Depends: libwebkit2gtk-4.1-0, libwebkit2gtk-4.1-dev
EOF
mkdir -p clave_${VERSION}_amd64/usr/{bin,share}
cp ../bin/Clave clave_${VERSION}_amd64/usr/bin/clave
chmod +x clave_${VERSION}_amd64/usr/bin/clave
mkdir clave_${VERSION}_amd64/usr/share/{applications,icons}
cat > clave_${VERSION}_amd64/usr/share/applications/clave.desktop <<- EOF
[Desktop Entry]
Type=Application
Name=Clave
Exec=/usr/bin/clave
Icon=/usr/share/icons/appicon.png
Categories=Utility;
Terminal=false
EOF
cp ../build/appicon.png clave_${VERSION}_amd64/usr/share/icons
dpkg-deb --build clave_${VERSION}_amd64
ls -alh
mv *.deb ../linuxDeb/clave_${VERSION}_amd64.deb
cd ..
echo "LINUX_DEB_PATH=linuxDeb/clave_${VERSION}_amd64.deb" >> $GITHUB_ENV
ls -alh linuxDeb/
- name: Upload AppImage to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event_name == 'workflow_dispatch' && inputs.release_url || github.event.release.upload_url }}
asset_path: ${{ env.LINUX_APP_PATH }}
asset_name: clave_${{ github.event.release.tag_name || inputs.version }}_amd64.AppImage
asset_content_type: application/x-executable
- name: Upload deb to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event_name == 'workflow_dispatch' && inputs.release_url || github.event.release.upload_url }}
asset_path: ${{ env.LINUX_DEB_PATH }}
asset_name: clave_${{ github.event.release.tag_name || inputs.version }}_amd64.deb
asset_content_type: application/x-debian-package