Skip to content

Commit df68704

Browse files
committed
Detach, sign and reattach burn-engine during windows CI
1 parent 85771ef commit df68704

File tree

1 file changed

+69
-9
lines changed

1 file changed

+69
-9
lines changed

.github/workflows/release.yaml

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ jobs:
225225
asset_path: src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
226226
asset_name: defguard-${{ matrix.target }}-${{ env.VERSION }}.pkg
227227
asset_content_type: application/octet-stream
228+
229+
# Building signed windows bundle involves a few steps as described here:
230+
# https://wixtoolset.org/docs/tools/signing/#signing-bundles-at-the-command-line
231+
# 1. Build defguard & bundle the binaries (defguard & wireguard) using wix (windows)
232+
# 2. Detach the burn engine from the bundle so that it can be signed (also windows)
233+
# 3. Sign the burn engine (linux)
234+
# 4. Reattach the burn engine back to the bundle (windows again)
235+
# 5. Sign the whole bundle (linux)
228236
build-windows:
229237
needs:
230238
- create-release
@@ -271,18 +279,70 @@ jobs:
271279
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
272280
- name: Bundle application
273281
run: |
282+
# prepare wix extension
274283
dotnet tool install --global wix --version 4.0.5
275284
wix extension add WixToolset.Bal.wixext/4
285+
# bundle defguard & wireguard binaries together
276286
wix build .\src-tauri\resources-windows\defguard-client.wxs -ext .\.wix\extensions\WixToolset.Bal.wixext\4\wixext4\WixToolset.Bal.wixext.dll
277-
- name: Upload installer artifact
287+
# detach burn engine from the bundle to be signed
288+
wix burn detach .\src-tauri\resources-windows\defguard-client.exe -engine .\src-tauri\resources-windows\burnengine.exe
289+
- name: Upload unsigned bundle and burn-engine
278290
uses: actions/upload-artifact@v4
279291
with:
280-
name: defguard-client.exe
281-
path: src-tauri/resources-windows/defguard-client.exe
282-
sign-msi:
292+
name: unsigned-bundle-and-burnengine
293+
path: |
294+
src-tauri/resources-windows/defguard-client.exe
295+
src-tauri/resources-windows/burnengine.exe
296+
sign-burn-engine:
283297
needs:
284298
- build-windows
299+
runs-on:
300+
- self-hosted
301+
- Linux
302+
steps:
303+
- name: Write release version
304+
run: |
305+
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
306+
echo Version: $VERSION
307+
echo "VERSION=$VERSION" >> $GITHUB_ENV
308+
- name: Download unsigned bundle & burn-engine
309+
uses: actions/download-artifact@v4
310+
with:
311+
name: unsigned-bundle-and-burnengine
312+
- name: Sign burn-engine
313+
run: osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in burnengine.exe -out burnengine-signed.exe
314+
- name: Upload bundle and burn-engine artifact
315+
uses: actions/upload-artifact@v4
316+
with:
317+
name: unsigned-bundle-and-signed-burnengine
318+
path: |
319+
src-tauri/resources-windows/defguard-client.exe
320+
src-tauri/resources-windows/burnengine-signed.exe
321+
reattach-burn-engine:
322+
needs:
323+
- sign-burn-engine
324+
runs-on: windows-latest
325+
steps:
326+
- name: Download unsigned bundle & signed burn-engine
327+
uses: actions/download-artifact@v4
328+
with:
329+
name: unsigned-bundle-and-signed-burnengine
330+
- name: Reattach burn-engine
331+
run: |
332+
# prepare wix extension
333+
dotnet tool install --global wix --version 4.0.5
334+
wix extension add WixToolset.Bal.wixext/4
335+
# reattach burn engine to the bundle
336+
wix burn reattach .\src-tauri\resources-windows\defguard-client.exe -engine .\src-tauri\resources-windows\burnengine-signed.exe -o defguard-client-reattached.exe
337+
- name: Upload bundle with reattached burn-engine
338+
uses: actions/upload-artifact@v4
339+
with:
340+
name: unsigned-bundle-with-reattached-signed-burn-engine
341+
path: defguard-client-reattached.exe
342+
sign-bundle:
343+
needs:
285344
- create-release
345+
- reattach-burn-engine
286346
runs-on:
287347
- self-hosted
288348
- Linux
@@ -292,13 +352,13 @@ jobs:
292352
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
293353
echo Version: $VERSION
294354
echo "VERSION=$VERSION" >> $GITHUB_ENV
295-
- name: Download a single artifact
355+
- name: Download unsigned bundle & signed burn-engine
296356
uses: actions/download-artifact@v4
297357
with:
298-
name: defguard-client.exe
299-
- name: Sign MSI
300-
run: osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in defguard-client.exe -out defguard-client-signed.exe
301-
- name: Upload installer
358+
name: unsigned-bundle-with-reattached-signed-burn-engine
359+
- name: Sign bundle
360+
run: osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.68-MS.so -certs /srv/codesign/29ee7778ca5217107841bbbf6b3062e1.pem -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in defguard-client-reattached.exe -out defguard-client-signed.exe
361+
- name: Upload installer asset
302362
uses: actions/[email protected]
303363
env:
304364
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)