1+ # Modified from dAppServer/[email protected] 2+ name : " Wails Build Action"
3+ description : " Creates a wails binary"
4+ branding :
5+ icon : ' box'
6+ color : ' purple'
7+ inputs :
8+ build :
9+ description : " Platform to build for"
10+ required : false
11+ default : " true"
12+ sign :
13+ description : " Sign the build"
14+ required : false
15+ default : " false"
16+ package :
17+ description : " Uploads workflow & uploads tag builds to a release"
18+ required : false
19+ default : " true"
20+ nsis :
21+ description : " Build a Windows Installer"
22+ required : false
23+ default : " true"
24+ build-name :
25+ description : " The name of the binary file"
26+ required : true
27+ build-platform :
28+ description : " Platform to build for"
29+ required : false
30+ default : " darwin/universal"
31+ wails-version :
32+ description : " Wails version to use"
33+ required : false
34+ default : " latest"
35+ wails-build-webview2 :
36+ description : " Webview2 installer method [download,embed,browser,error]"
37+ required : false
38+ default : " download"
39+ go-version :
40+ description : " Version of Go to use"
41+ required : false
42+ default : " ^1.18"
43+ node-version :
44+ description : " Node js version"
45+ required : false
46+ default : " 16.x"
47+ deno-build :
48+ description : " This gets run into bash, use the full command"
49+ required : false
50+ default : " "
51+ app-working-directory :
52+ description : " This gets run into bash, use the full command"
53+ required : false
54+ default : " ."
55+ deno-working-directory :
56+ description : " This gets run into bash, use the full command"
57+ required : false
58+ default : " ."
59+ deno-version :
60+ description : " Deno version to use"
61+ required : false
62+ default : " v1.20.x"
63+ sign-macos-app-id :
64+ description : " MacOS Application Certificate id"
65+ required : false
66+ default : ' '
67+ sign-macos-apple-password :
68+ description : " MacOS Apple password"
69+ required : false
70+ default : ' '
71+ sign-macos-app-cert :
72+ description : " MacOS Application Certificate"
73+ required : false
74+ default : ' '
75+ sign-macos-app-cert-password :
76+ description : " MacOS Application Certificate Password"
77+ required : false
78+ default : ' '
79+ sign-macos-installer-id :
80+ description : " MacOS Installer Certificate id"
81+ required : false
82+ default : ' '
83+ sign-macos-installer-cert :
84+ description : " MacOS Installer Certificate"
85+ required : false
86+ default : ' '
87+ sign-macos-installer-cert-password :
88+ description : " MacOS Installer Certificate Password"
89+ required : false
90+ default : ' '
91+ sign-macos-apple-id :
92+ description : " Apple ID"
93+ required : true
94+ default : ' '
95+ sign-macos-apple-id-password :
96+ description : " Apple ID Password"
97+ required : true
98+ default : ' '
99+ sign-macos-apple-team-id :
100+ description : " Apple Team ID"
101+ required : true
102+ default : ' '
103+ sign-windows-cert :
104+ description : " Windows Signing Certificate"
105+ required : false
106+ default : ' '
107+ sign-windows-cert-password :
108+ description : " Windows Signing Certificate Password"
109+ required : false
110+ default : ' '
111+ p12-file-base64 :
112+ description : ' The certificates in a PKCS12 file encoded as a base64 string.'
113+ required : true
114+ p12-password :
115+ description : ' The password used to import the PKCS12 file.'
116+ required : true
117+
118+ runs :
119+ using : " composite"
120+ steps :
121+ # Setup and configure GoLang
122+ - name : Setup GoLang
123+ uses : actions/setup-go@v4
124+ with :
125+ check-latest : true
126+ go-version : ${{inputs.go-version}}
127+ - run : go version
128+ shell : bash
129+ # Setup and configure NodeJS
130+ - name : Setup NodeJS
131+ uses : actions/setup-node@v3
132+ with :
133+ node-version : ${{inputs.node-version}}
134+ # (Optional) Setup and configure Deno
135+ - name : Setup Deno
136+ uses : denoland/setup-deno@v1
137+ if : inputs.deno-build != ''
138+ with :
139+ deno-version : ${{inputs.deno-version}}
140+ - name : Run Deno Command
141+ if : inputs.deno-build != ''
142+ shell : bash
143+ working-directory : ${{inputs.deno-working-directory}}
144+ run : ${{inputs.deno-build}}
145+ # install wails
146+ - name : Install Wails
147+ if : inputs.build == 'true'
148+ run : go install github.com/wailsapp/wails/v2/cmd/wails@${{inputs.wails-version}}
149+ shell : bash
150+ - name : Install Linux Wails deps
151+ if : inputs.build == 'true' && runner.os == 'Linux'
152+ run : sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
153+ shell : bash
154+ # Building step
155+ - name : Build App
156+ if : inputs.build == 'true' && runner.os == 'macOS'
157+ working-directory : ${{ inputs.app-working-directory }}
158+ run : wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o '${{inputs.build-name}}'
159+ shell : bash
160+ - name : Build App
161+ if : inputs.build == 'true' && runner.os == 'Linux'
162+ working-directory : ${{ inputs.app-working-directory }}
163+ run : wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o '${{inputs.build-name}}'
164+ shell : bash
165+ - name : Build Windows App
166+ if : inputs.build == 'true' && runner.os == 'Windows' && inputs.nsis == 'false'
167+ working-directory : ${{ inputs.app-working-directory }}
168+ run : wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -o '${{inputs.build-name}}.exe'
169+ shell : bash
170+ - name : Build Windows App + Installer
171+ if : inputs.build == 'true' && runner.os == 'Windows' && inputs.nsis == 'true'
172+ working-directory : ${{ inputs.app-working-directory }}
173+ run : GCO_ENABLE=1 wails build --platform ${{inputs.build-platform}} -webview2 ${{inputs.wails-build-webview2}} -nsis -o '${{inputs.build-name}}.exe'
174+ shell : bash
175+ - name : Add macOS perms
176+ if : inputs.build == 'true' && runner.os == 'macOS'
177+ working-directory : ${{ inputs.app-working-directory }}
178+ run : chmod +x build/bin/*/Contents/MacOS/*
179+ shell : bash
180+ - name : Add Linux perms
181+ if : inputs.build == 'true' && runner.os == 'Linux'
182+ working-directory : ${{ inputs.app-working-directory }}
183+ run : chmod +x build/bin/*
184+ shell : bash
185+ # Package and Sign MacOS
186+ - name : Codesign, notarize, and staple the macOS build (producing a .zip and .dmg)
187+ if : runner.os == 'macOS'
188+ uses : ./.github/actions/xcode-notarization-action
189+ id : notarize
190+ with :
191+ build-name : ${{ inputs.build-name }}
192+ apple-id : ${{ inputs.sign-macos-apple-id }}
193+ password : ${{ inputs.sign-macos-apple-id-password }}
194+ team-id : ${{ inputs.sign-macos-apple-team-id }}
195+ xcode-path : ' /Applications/Xcode.app'
196+ p12-file-base64 : ${{ inputs.p12-file-base64 }}
197+ p12-password : ${{ inputs.p12-password }}
198+ # Windows signing
199+ - name : Sign Windows binaries
200+ shell : powershell
201+ if : runner.os == 'Windows' && inputs.sign != 'false' && inputs.sign-windows-cert != ''
202+ working-directory : ${{ inputs.app-working-directory }}
203+ run : |
204+ echo "Creating certificate file"
205+ New-Item -ItemType directory -Path certificate
206+ Set-Content -Path certificate\certificate.txt -Value '${{ inputs.sign-windows-cert }}'
207+ certutil -decode certificate\certificate.txt certificate\certificate.pfx
208+ echo "Signing our binaries"
209+ & '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'
210+ 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'
211+
212+ # Upload build assets
213+ - name : Prepare Linux Release Builds
214+ shell : bash
215+ if : inputs.build-platform == 'linux/amd64'
216+ working-directory : ${{ inputs.app-working-directory }}
217+ run : |
218+ mkdir build/bin/publish
219+ tar -czvf "build/bin/publish/$(echo "${{ inputs.build-name }}" | sed "s/ /-/g")-linux-amd64.tar.gz" 'build/bin/${{ inputs.build-name }}'
220+ - name : Prepare Windows Release Builds
221+ shell : powershell
222+ if : inputs.build-platform == 'windows/amd64'
223+ working-directory : ${{ inputs.app-working-directory }}
224+ run : |
225+ mkdir build/bin/publish
226+ Compress-Archive -Path 'build/bin/${{ inputs.build-name }}.exe' -DestinationPath 'build/bin/publish/${{ inputs.build-name }}-windows-amd64.zip'.replace(' ', '-')
227+ mv 'build/bin/${{ inputs.build-name }}-amd64-installer.exe' 'build/bin/publish/${{ inputs.build-name }}-windows-amd64-installer.exe'.replace(' ', '-')
228+ - name : Prepare macOS Release Builds
229+ shell : bash
230+ if : inputs.build-platform == 'darwin/universal'
231+ working-directory : ${{ inputs.app-working-directory }}
232+ run : |
233+ mkdir build/bin/publish
234+ mv 'build/bin/${{ inputs.build-name }}.app.zip' "build/bin/publish/$(echo "${{ inputs.build-name }}" | sed "s/ /-/g")-macOS-universal.app.zip"
235+ mv 'build/bin/${{ inputs.build-name }}.dmg' "build/bin/publish/$(echo "${{ inputs.build-name }}" | sed "s/ /-/g")-macOS-universal-installer.dmg"
236+ - uses : actions/upload-artifact@v4
237+ if : inputs.package == 'true'
238+ with :
239+ name : Wails Build ${{runner.os}} ${{inputs.build-name}}
240+ path : |
241+ */bin/publish/
242+ *\bin\publish\*
243+ - name : Release
244+ uses : softprops/action-gh-release@v2
245+ if : inputs.package == 'true' && startsWith(github.ref, 'refs/tags/')
246+ with :
247+ files : |
248+ */bin/publish/*
0 commit comments