wails.yml raw
1 name: Wails build - all platforms
2
3 on:
4 push:
5 branches:
6 - master
7 pull_request:
8 types: [opened, synchronize]
9
10 workflow_call:
11 inputs:
12 build-release:
13 description: "Build full-featured release (codesigning, notarization, etc.)"
14 type: boolean
15 secrets:
16 APPLE_DEVELOPER_CERTIFICATE_P12_BASE64:
17 required: true
18 APPLE_DEVELOPER_CERTIFICATE_PASSWORD:
19 required: true
20 APPLE_PASSWORD:
21 required: true
22 APPLE_TEAM_ID:
23 required: true
24 APPLE_USERNAME:
25 required: true
26
27 jobs:
28 build:
29 strategy:
30 fail-fast: false
31 matrix:
32 build:
33 [
34 { platform: linux/amd64, os: ubuntu-22.04 },
35 { platform: linux/amd64, os: ubuntu-24.04 },
36 { platform: windows/amd64, os: windows-2022 },
37 { platform: darwin/universal, os: macos-14 },
38 ]
39 runs-on: ${{ matrix.build.os }}
40 env:
41 TAG: ${{ github.ref_name }}
42 steps:
43 - name: Setup
44 shell: bash
45 run: |
46 echo "EXEC_NAME=Alby Hub" >> $GITHUB_ENV
47 if [ "${{ matrix.build.os }}" == "ubuntu-24.04" ]; then
48 echo "PACKAGE_NAME=albyhub-Desktop-Linux-Ubuntu-24.04" >> $GITHUB_ENV
49 echo "LIBWEBKIT2GTK=libwebkit2gtk-4.1-dev" >> $GITHUB_ENV
50 else
51 echo "PACKAGE_NAME=albyhub-Desktop-${{ runner.os }}" >> $GITHUB_ENV
52 echo "LIBWEBKIT2GTK=libwebkit2gtk-4.0-dev" >> $GITHUB_ENV
53 fi
54
55 - uses: actions/checkout@v4
56 with:
57 submodules: recursive
58
59 - name: Install dependencies
60 if: runner.os == 'Linux'
61 run: |
62 sudo apt-get update
63 sudo apt-get install -y patchelf
64
65 - name: Setup GoLang
66 uses: actions/setup-go@v5
67 with:
68 go-version-file: "./go.mod"
69
70 - name: Get dependencies
71 run: go get -v -t -d ./...
72
73 - name: Setup NodeJS
74 uses: actions/setup-node@v4
75 with:
76 node-version: "22.x"
77
78 - name: Install Wails
79 run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.14.0
80 shell: bash
81
82 - name: Install Linux Wails deps
83 if: runner.os == 'Linux'
84 run: sudo apt-get update && sudo apt-get install libgtk-3-0 ${{ env.LIBWEBKIT2GTK }} gcc-aarch64-linux-gnu
85 shell: bash
86
87 - name: Install macOS Wails deps
88 if: runner.os == 'macOS'
89 run: |
90 brew install create-dmg
91 brew install Bearer/tap/gon
92 shell: bash
93
94 - name: Wails Doctor
95 working-directory: .
96 run: wails doctor
97 shell: bash
98
99 # On Windows, we need the shared libraries to be found in the same directory
100 # as the executable. Wails build will fail otherwise.
101 - name: Copy shared libraries
102 if: runner.os == 'Windows'
103 run: |
104 cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-pc-windows-msvc/ldk_node.dll ./
105 shell: bash
106
107 - name: Copy appicon in place
108 run: mkdir -p build && cp appicon.png build
109 shell: bash
110
111 - name: Build App
112 if: runner.os == 'macOS'
113 run: wails build --platform darwin/universal -webview2 embed -o "${{ env.EXEC_NAME }}" -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
114 shell: bash
115
116 - name: Build App
117 if: runner.os == 'Linux' && matrix.build.os != 'ubuntu-24.04'
118 run: wails build --platform linux/amd64 -webview2 embed -o "${{ env.EXEC_NAME }}" -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
119 shell: bash
120
121 - name: Build App
122 if: runner.os == 'Linux' && matrix.build.os == 'ubuntu-24.04'
123 run: wails build --platform linux/amd64 -webview2 embed -o "${{ env.EXEC_NAME }}" -tags "wails,webkit2_41" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
124 shell: bash
125
126 - name: Build Windows App
127 if: runner.os == 'Windows'
128 run: wails build --platform windows/amd64 -webview2 embed -o "${{ env.EXEC_NAME }}.exe" -tags "wails" -ldflags "-X 'github.com/getAlby/hub/version.Tag=${{ env.TAG }}'"
129 shell: bash
130
131 - name: Import Code-Signing Certificates for macOS
132 if: >-
133 runner.os == 'macOS' &&
134 (
135 !github.event.pull_request ||
136 (
137 github.event.pull_request.head.repo.full_name == github.repository &&
138 github.actor != 'dependabot[bot]'
139 )
140 )
141 uses: Apple-Actions/import-codesign-certs@v3
142 with:
143 # The certificates in a PKCS12 file encoded as a base64 string
144 p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
145 # The password used to import the PKCS12 file.
146 p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
147
148 - name: Copy DLLs to the output directory
149 if: runner.os == 'Windows'
150 run: |
151 cp ldk_node.dll ./build/bin/
152 shell: bash
153
154 - name: Copy shared libraries to the output directory and adjust directory structure
155 if: runner.os == 'Linux'
156 run: |
157 mkdir -p ./build/bin/${{ env.PACKAGE_NAME }}/lib
158 cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-unknown-linux-gnu/libldk_node.so ./build/bin/${{ env.PACKAGE_NAME }}/lib/
159 mkdir -p ./build/bin/${{ env.PACKAGE_NAME }}/bin
160 mv "./build/bin/${{ env.EXEC_NAME }}" ./build/bin/${{ env.PACKAGE_NAME }}/bin/
161 shell: bash
162
163 - name: Patch executable RPATH
164 if: runner.os == 'Linux'
165 run: |
166 patchelf --force-rpath --set-rpath '$ORIGIN/../lib' "./build/bin/${{ env.PACKAGE_NAME }}/bin/${{ env.EXEC_NAME }}"
167
168 - name: Copy shared libraries to the output directory
169 if: runner.os == 'macOS'
170 run: |
171 mkdir -p "./build/bin/${{ env.EXEC_NAME }}.app/Contents/Frameworks"
172 cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/universal-macos/libldk_node.dylib "./build/bin/${{ env.EXEC_NAME }}.app/Contents/Frameworks/"
173 shell: bash
174
175 - name: Patch executable RPATH
176 if: runner.os == 'macOS'
177 run: |
178 install_name_tool -add_rpath @executable_path/../Frameworks "./build/bin/${{ env.EXEC_NAME }}.app/Contents/MacOS/${{ env.EXEC_NAME }}"
179
180 - name: Add macOS perms
181 if: runner.os == 'macOS'
182 run: chmod +x "build/bin/${{ env.EXEC_NAME }}.app/Contents/MacOS/${{ env.EXEC_NAME }}"
183 shell: bash
184
185 - name: Add Linux perms
186 if: runner.os == 'Linux'
187 run: chmod +x "build/bin/${{ env.PACKAGE_NAME }}/bin/${{ env.EXEC_NAME }}"
188 shell: bash
189
190 # Store everything in a tar archive to preserve permissions
191 # (specifically, the executable bit on the app executable).
192 - name: Make output tar archive
193 if: runner.os == 'Linux'
194 run: |
195 mkdir -p ./build/out
196 tar -cjf ./build/out/${{ env.PACKAGE_NAME }}.tar.bz2 -C ./build/bin .
197 rm -Rf ./build/bin/*
198 mv ./build/out/${{ env.PACKAGE_NAME }}.tar.bz2 ./build/bin/
199
200 - name: Sign the macOS binary
201 if: >-
202 runner.os == 'macOS' &&
203 (
204 !github.event.pull_request ||
205 (
206 github.event.pull_request.head.repo.full_name == github.repository &&
207 github.actor != 'dependabot[bot]'
208 )
209 )
210 run: |
211 echo "Signing Package"
212 /usr/bin/codesign -s "Developer ID Application: Alby Inc." -f -v --deep --timestamp --options runtime --entitlements ./build/darwin/entitlements.plist "./build/bin/${{ env.EXEC_NAME }}.app"
213 env:
214 AC_USERNAME: ${{ secrets.APPLE_USERNAME }}
215 AC_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
216 AC_PROVIDER: ${{ secrets.APPLE_TEAM_ID }}
217
218 - name: Make DMG image for macOS
219 if: runner.os == 'macOS'
220 run: |
221 mkdir -p ./build/out
222 create-dmg --volname "Alby Hub" --background "./build/darwin/dmgcover.png" --window-pos 200 120 --window-size 800 400 --icon-size 80 --icon "${{ env.EXEC_NAME }}.app" 200 160 --hide-extension "${{ env.EXEC_NAME }}.app" --app-drop-link 600 160 "./build/out/${{ env.PACKAGE_NAME }}.dmg" "./build/bin/${{ env.EXEC_NAME }}.app"
223 rm -Rf ./build/bin/*
224 mv ./build/out/${{ env.PACKAGE_NAME }}.dmg ./build/bin/
225
226 - name: Generate gon-notarize.json
227 if: runner.os == 'macOS'
228 run: |
229 cat > ./build/darwin/gon-notarize.json << EOF
230 {
231 "notarize": [
232 {
233 "path": "./build/bin/${PACKAGE_NAME}.dmg",
234 "bundle_id": "com.getalby.AlbyHub"
235 }
236 ]
237 }
238 EOF
239
240 - name: Notarize the DMG image
241 if: >-
242 runner.os == 'macOS' &&
243 (
244 !github.event.pull_request ||
245 (
246 github.event.pull_request.head.repo.full_name == github.repository &&
247 github.actor != 'dependabot[bot]'
248 )
249 )
250 run: |
251 echo "Notarizing Zip Files"
252 gon -log-level=info -log-json ./build/darwin/gon-notarize.json
253 env:
254 AC_USERNAME: ${{ secrets.APPLE_USERNAME }}
255 AC_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
256 AC_PROVIDER: ${{ secrets.APPLE_TEAM_ID }}
257
258 - name: Make Windows ZIP archive
259 if: runner.os == 'Windows'
260 run: |
261 mkdir -p ./build/out
262 7z a -tzip ./build/out/${{ env.PACKAGE_NAME }}.zip ./build/bin/*
263 rm -Rf ./build/bin/*
264 mv ./build/out/${{ env.PACKAGE_NAME }}.zip ./build/bin/
265 shell: bash
266
267 - uses: actions/upload-artifact@v4
268 if: runner.os == 'Linux'
269 with:
270 name: ${{ env.PACKAGE_NAME }}
271 path: |
272 ./build/bin/${{ env.PACKAGE_NAME }}.tar.bz2
273 if-no-files-found: error
274
275 - uses: actions/upload-artifact@v4
276 if: runner.os == 'macOS'
277 with:
278 name: ${{ env.PACKAGE_NAME }}
279 path: |
280 ./build/bin/${{ env.PACKAGE_NAME }}.dmg
281 if-no-files-found: error
282
283 - uses: actions/upload-artifact@v4
284 if: runner.os == 'Windows'
285 with:
286 name: ${{ env.PACKAGE_NAME }}
287 path: |
288 ./build/bin/${{ env.PACKAGE_NAME }}.zip
289 if-no-files-found: error
290