forked from dAppServer/wails-build-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
276 lines (259 loc) · 10.1 KB
/
action.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
name: Wails Build
description: Creates a Wails binary. Supports Bun & Deno.
branding:
icon: "archive"
color: "green"
inputs:
build:
description: "Run 'wails build'"
required: false
default: true
sign:
description: "Sign the build"
required: false
default: false
package:
description: "Uploads workflow artifacts & uploads tag builds to a release"
required: false
default: true
nsis:
description: "Build a Windows Installer"
required: true
build-name:
description: "The name of the binary file"
required: true
build-platform:
description: "Platform to build for"
required: false
default: "darwin/universal"
wails-version:
description: "Wails version to use"
required: false
default: "latest"
wails-build-webview2:
description: "WebView2 installer method [download, embed, browser, error]"
required: false
default: "download"
go-version:
description: "Go version to use"
required: false
default: "^1.22"
node-version:
description: "Version of NodeJS to use"
required: false
default: 20
setup-bun:
description: "Whether to setup Bun"
required: false
default: false
bun-version:
description: "Bun version to use"
required: false
default: "latest"
deno-build:
description: "This gets run into bash, use the full command"
required: false
default: ""
app-working-directory:
description: "This gets run into bash, use the full command"
required: false
default: "."
deno-working-directory:
description: "This gets run into bash, use the full command"
required: false
default: "."
deno-version:
description: "Version of Deno to use"
required: false
default: "v1.x"
sign-macos-app-id:
description: "MacOS Application Certificate ID"
required: false
default: ""
sign-macos-apple-password:
description: "MacOS Apple Password"
required: false
default: ""
sign-macos-app-cert:
description: "MacOS Application Certificate"
required: false
default: ""
sign-macos-app-cert-password:
description: "MacOS Application Certificate Password"
required: false
default: ""
sign-macos-installer-id:
description: "MacOS Installer Certificate ID"
required: false
default: ""
sign-macos-installer-cert:
description: "MacOS Installer Certificate"
required: false
default: ""
sign-macos-installer-cert-password:
description: "MacOS Installer Certificate Password"
required: false
default: ""
sign-windows-cert:
description: "Windows Signing Certificate"
required: false
default: ""
sign-windows-cert-password:
description: "Windows Signing Certificate Password"
required: false
default: ""
runs:
using: "composite"
steps:
# Setup and configure Go
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version: ${{inputs.go-version}}
- run: go version
shell: bash
# Setup and configure NodeJS
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{inputs.node-version}}
# (Optional) Setup and configure Bun
- name: Setup Bun
uses: oven-sh/setup-bun@v2
if: inputs.setup-bun == 'true'
with:
bun-version: ${{inputs.bun-version}}
# (Optional) Setup and configure Deno
- name: Setup Deno
uses: denoland/setup-deno@v1
if: inputs.deno-build != ''
with:
deno-version: ${{inputs.deno-version}}
- name: Run Deno Command
if: inputs.deno-build != ''
shell: bash
working-directory: ${{inputs.deno-working-directory}}
run: ${{inputs.deno-build}}
# Install Wails & Platform Deps
- name: Install Wails
if: inputs.build == 'true'
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{inputs.wails-version}}
shell: bash
- name: Install Linux Wails deps
if: inputs.build == 'true' && runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
shell: bash
- name: Install MacOS Wails deps
if: runner.os == 'macOS'
run: brew install mitchellh/gon/gon
shell: bash
# Build Step
- name: Build Windows App
if: inputs.build == 'true' && inputs.nsis == 'false' && runner.os == 'Windows'
working-directory: ${{ inputs.app-working-directory }}
run: wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o ${{inputs.build-name}}
shell: bash
- name: Build Windows App + Installer
if: inputs.build == 'true' && inputs.nsis == 'true' && runner.os == 'Windows'
working-directory: ${{ inputs.app-working-directory }}
run: wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -nsis -o ${{inputs.build-name}}
shell: bash
- name: Build App
if: inputs.build == 'true' && runner.os == 'macOS'
working-directory: ${{ inputs.app-working-directory }}
run: wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o ${{inputs.build-name}}
shell: bash
- name: Build App
if: inputs.build == 'true' && runner.os == 'Linux'
working-directory: ${{ inputs.app-working-directory }}
run: wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o ${{inputs.build-name}}
shell: bash
- name: Add MacOS perms
if: inputs.build == 'true' && runner.os == 'macOS'
working-directory: ${{ inputs.app-working-directory }}
run: chmod +x build/bin/*/Contents/MacOS/*
shell: bash
- name: Add Linux perms
if: inputs.build == 'true' && runner.os == 'Linux'
working-directory: ${{ inputs.app-working-directory }}
run: chmod +x build/bin/*
shell: bash
# Package and Sign MacOS
- name: Import Code-Signing Certificates for MacOS
if: runner.os == 'macOS' && inputs.sign == 'true' && startsWith(github.ref, 'refs/tags/')
uses: Apple-Actions/import-codesign-certs@v3
with:
keychain-password: ${{ inputs.sign-macos-apple-password }}
p12-file-base64: ${{ inputs.sign-macos-app-cert }}
p12-password: ${{ inputs.sign-macos-app-cert-password }}
- name: Import Code-Signing Certificates for MacOS Installer
if: runner.os == 'macOS' && inputs.sign == 'true' && startsWith(github.ref, 'refs/tags/')
uses: Apple-Actions/import-codesign-certs@v3
with:
keychain-password: ${{ inputs.sign-macos-apple-password }}
p12-file-base64: ${{ inputs.sign-macos-installer-cert }}
p12-password: ${{ inputs.sign-macos-installer-cert-password }}
create-keychain: false
- name: Sign our MacOS binary
if: runner.os == 'macOS' && inputs.sign == 'true' && startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ${{ inputs.app-working-directory }}
env:
APPLE_PASSWORD: ${{ inputs.sign-macos-apple-password }}
run: |
echo "Signing Package"
gon -log-level=info ./build/darwin/gon-sign.json
- name: Build .app zip file
if: runner.os == 'macOS'
working-directory: ${{ inputs.app-working-directory }}
shell: bash
run: |
ditto -c -k ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.app ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.app.zip
- name: Building Installer
if: runner.os == 'macOS' && inputs.sign == 'true' && inputs.sign-macos-installer-id != '' && startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ${{ inputs.app-working-directory }}
run: |
productbuild --sign '${{inputs.sign-macos-installer-id}}' --component ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.app ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.pkg
- name: Building Installer
if: runner.os == 'macOS' && inputs.sign-macos-installer-id == '' && startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ${{ inputs.app-working-directory }}
run: |
productbuild --component ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.app ${{ inputs.app-working-directory }}/build/bin/${{inputs.build-name}}.pkg
- name: Notarising Installer and ZIP
if: runner.os == 'macOS' && inputs.sign == 'true' && startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ${{ inputs.app-working-directory }}
env:
APPLE_PASSWORD: ${{ inputs.sign-macos-apple-password }}
run: |
gon -log-level=info ${{ inputs.app-working-directory }}/build/darwin/gon-notarize.json
# Windows signing
- name: Sign Windows binaries
shell: powershell
if: runner.os == 'Windows' && inputs.sign == 'true' && inputs.sign-windows-cert != ''
working-directory: ${{ inputs.app-working-directory }}
run: |
echo "Creating certificate file"
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ inputs.sign-windows-cert }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
echo "Signing our binaries"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ inputs.sign-windows-cert-password }}' .\build\bin\${{inputs.build-name}}.exe
echo "Signing Installer" & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ inputs.sign-windows-cert-password }}' .\build\bin\${{inputs.build-name}}-amd64-installer.exe
# Upload build assets
- uses: actions/upload-artifact@v4
if: inputs.package == 'true'
with:
name: ${{inputs.build-name}} (${{runner.os}})
path: |
*/bin/
*\bin\*
- name: Release
uses: softprops/action-gh-release@v1
if: inputs.package == 'true' && startsWith(github.ref, 'refs/tags/')
with:
files: |
*/bin/*