Skip to content

Commit 59396da

Browse files
committed
feat: add github action to sign installer
1 parent 4285a3b commit 59396da

4 files changed

Lines changed: 69 additions & 43 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Build
22
on:
33
push:
4+
branches: ['**']
45

56
# prevent duplicate runs on the same branch
67
concurrency:
7-
group: ${{ github.workflow }}-${{ github.sha }}
8+
group: ${{ github.workflow }}-${{ github.ref }}
89
cancel-in-progress: true
910

1011
jobs:
@@ -13,7 +14,6 @@ jobs:
1314
runs-on: ${{ matrix.os }}
1415
strategy:
1516
matrix:
16-
#os: [ubuntu-latest, windows-latest, macos-latest]
1717
os: [ubuntu-latest, windows-latest]
1818
steps:
1919
- name: Check out code

.github/workflows/publish.yml

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
name: Publish
22
on:
33
release:
4-
types: [released, prereleased]
4+
types: [published]
55
pull_request:
66
branches:
77
- master
88

9+
permissions:
10+
contents: write
11+
912
# prevent duplicate runs on the same branch
1013
concurrency:
11-
group: ${{ github.workflow }}-${{ github.sha }}
12-
cancel-in-progress: true
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: ${{ github.event_name != 'release' }}
1316

1417
jobs:
1518
publish:
1619
name: Build
1720
runs-on: ${{ matrix.os }}
1821
strategy:
1922
matrix:
20-
#os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm]
2123
os: [ubuntu-latest, windows-latest, ubuntu-24.04-arm]
2224
steps:
2325
- name: Check out code
@@ -33,48 +35,62 @@ jobs:
3335
- name: Setup Gradle
3436
uses: gradle/actions/setup-gradle@v6
3537

36-
- name: Package App
38+
- name: Read version
3739
working-directory: ./pretixscan
3840
shell: bash
39-
run: ./gradlew packageDistributionForCurrentOS -PappPackageName="${{ runner.os == 'Windows' && 'pretixSCAN Desktop' || 'pretixSCAN' }}"
41+
run: |
42+
version="$(./gradlew -q printVersion | sed -n 's/^pretixVersion=//p' | tr -d '\r')"
43+
test -n "$version"
44+
echo "pretixVersion=$version" >> "$GITHUB_ENV"
4045
41-
- name: Read version
46+
- name: Package App
4247
working-directory: ./pretixscan
4348
shell: bash
44-
run: ./gradlew -q printVersion >> $GITHUB_ENV
45-
46-
# - name: Sign Windows Installer
47-
# if: matrix.os == 'windows-latest'
48-
# working-directory: ./pretixscan
49-
# shell: bash
50-
# run: ./gradlew signWindowsMsi
49+
run: ./gradlew packageDistributionForCurrentOS -PappPackageName="${{ runner.os == 'Windows' && 'pretixSCAN Desktop' || 'pretixSCAN' }}"
5150

52-
# Upload Windows executables and installers
53-
- name: Upload Windows Apps
54-
if: matrix.os == 'windows-latest'
55-
uses: actions/upload-artifact@v7
51+
# Only sign on releases to stay within the monthly signature quota
52+
- name: Sign Windows Installer
53+
if: matrix.os == 'windows-latest' && github.event_name == 'release'
54+
uses: azure/artifact-signing-action@v2
5655
with:
57-
name: pretixSCAN-${{ env.pretixVersion }}-win-x86_64.msi
58-
path: ./pretixscan/composeApp/build/compose/binaries/main/msi/pretixSCAN Desktop-${{ env.pretixVersion }}.msi
56+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
57+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
58+
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
59+
endpoint: https://neu.codesigning.azure.net/
60+
signing-account-name: pretix
61+
certificate-profile-name: pretix
62+
files-folder: ${{ github.workspace }}\pretixscan\composeApp\build\compose\binaries\main\msi
63+
files-folder-filter: msi
64+
file-digest: SHA256
65+
timestamp-rfc3161: http://timestamp.acs.microsoft.com
66+
timestamp-digest: SHA256
67+
exclude-azure-cli-credential: true
5968

60-
- name: Upload Linux amd64
61-
if: matrix.os == 'ubuntu-latest'
62-
uses: actions/upload-artifact@v7
63-
with:
64-
name: pretixSCAN-${{ env.pretixVersion }}-linux-amd64.deb
65-
path: ./pretixscan/composeApp/build/compose/binaries/main/deb/pretixscan_${{ env.pretixVersion }}_amd64.deb
69+
- name: Collect installer
70+
shell: bash
71+
run: |
72+
mkdir dist
73+
binaries=./pretixscan/composeApp/build/compose/binaries/main
74+
case "${{ matrix.os }}" in
75+
windows-latest)
76+
cp "$binaries/msi/pretixSCAN Desktop-${pretixVersion}.msi" "dist/pretixSCAN-${pretixVersion}-win-x86_64.msi" ;;
77+
ubuntu-latest)
78+
cp "$binaries/deb/pretixscan_${pretixVersion}_amd64.deb" "dist/pretixSCAN-${pretixVersion}-linux-amd64.deb" ;;
79+
ubuntu-24.04-arm)
80+
cp "$binaries/deb/pretixscan_${pretixVersion}_arm64.deb" "dist/pretixSCAN-${pretixVersion}-linux-arm64.deb" ;;
81+
esac
82+
echo "installer=$(ls dist)" >> "$GITHUB_ENV"
6683
67-
- name: Upload Linux arm
68-
if: matrix.os == 'ubuntu-24.04-arm'
84+
- name: Upload workflow artifact
6985
uses: actions/upload-artifact@v7
7086
with:
71-
name: pretixSCAN-${{ env.pretixVersion }}-linux-arm64.deb
72-
path: ./pretixscan/composeApp/build/compose/binaries/main/deb/pretixscan_${{ env.pretixVersion }}_arm64.deb
87+
name: ${{ env.installer }}
88+
path: dist/${{ env.installer }}
89+
if-no-files-found: error
7390

74-
# Upload MacOS package
75-
- name: Upload MacOS App
76-
if: matrix.os == 'macos-latest'
77-
uses: actions/upload-artifact@v7
78-
with:
79-
name: pretixSCAN-${{ env.pretixVersion }}-macOS.dmg
80-
path: ./pretixscan/composeApp/build/compose/binaries/main/dmg/pretixscan-${{ env.pretixVersion }}.dmg
91+
- name: Attach installer to release
92+
if: github.event_name == 'release'
93+
shell: bash
94+
env:
95+
GH_TOKEN: ${{ github.token }}
96+
run: gh release upload "${{ github.event.release.tag_name }}" "dist/${installer}" --clobber

.github/workflows/sbom.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: SBOM
33
on:
44
push:
55
branches: [ master, main, sbom ]
6-
tags: [ 'v.*' ]
76

87
permissions:
98
contents: read # to fetch code (actions/checkout)
@@ -16,7 +15,9 @@ jobs:
1615
runs-on: ubuntu-latest
1716
name: Submission
1817
steps:
19-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
19+
with:
20+
submodules: true # needed for libpretixsync and libpretixprint
2021
- name: Set up Python
2122
uses: actions/setup-python@v5
2223
with:

RELEASE_CHECKLIST.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
- [ ] Bump version in all places
2-
- [ ] Commit
1+
- [ ] Set `version` and `versionCode` in `pretixscan/gradle.properties`.
2+
- `version` must be plain numeric MAJOR.MINOR.PATCH, and greater than the previous value so the MSI upgrades an existing install.
3+
- `versionCode` is sent to the pretix server as the device software version.
4+
- [ ] `cd pretixscan && ./gradlew clean build` passes.
5+
- [ ] Commit as `Bump to X.Y.Z` on a branch and open a PR to `master`.
6+
- [ ] Build and Publish workflows succeeded on the PR.
7+
- [ ] Merge the PR.
8+
- [ ] Confirm the SBOM workflow for the merge has succeeded.
9+
- [ ] Create a GitHub release targeting master with a new tag `vX.Y.Z`.
10+
- [ ] The "Sign Windows Installer" job succeeds.
11+
- [ ] The MSI and DEBs installers are attached to the release.

0 commit comments

Comments
 (0)