-
Notifications
You must be signed in to change notification settings - Fork 1
348 lines (341 loc) · 13.9 KB
/
ci.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
name: Artifact CI
on:
push:
env:
JAVA_VERSION: 22
permissions:
contents: write
jobs:
build_bot_artifacts:
name: Build Discord Bot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- run: ./gradlew assembleBot
- name: Upload plugin artifact
uses: actions/upload-artifact@v4
with:
name: plugin
path: bot/build/plugin/*.zip
- name: Upload plugin bot
uses: actions/upload-artifact@v4
with:
name: bot
path: bot/build/bot/*.zip
build_desktop_app:
name: Build Desktop App
strategy:
matrix:
os: [ ubuntu-latest, macos-14, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: 'Set up latest JDK code tool jextract'
uses: oracle-actions/setup-java@v1
if: matrix.os == 'windows-latest'
with:
website: jdk.java.net
release: jextract
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{env.JAVA_VERSION}}
- uses: actions-rust-lang/setup-rust-toolchain@v1
if: matrix.os == 'windows-latest'
with:
cache-workspaces: app/desktop/uwp_helper
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development#add-a-step-to-your-workflow
- name: Setup MacOS signing
if: matrix.os == 'macos-14'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.MACOS_SIGNING_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.MAC_SIGNING_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.MAC_SIGNING_PASSWORD }}
PASSWORD: ${{ secrets.APPLE_PASSWORD }}
INSTALLER_CERTIFICATE_BASE64: ${{ secrets.APPLE_INSTALLER_KEY }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
INSTALLER_CERTIFICATE_PATH=$RUNNER_TEMP/installer_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$INSTALLER_CERTIFICATE_BASE64" | base64 --decode -o INSTALLER_CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import INSTALLER_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- run: ./gradlew packageReleaseDistributionForCurrentOS -Pcompose.desktop.mac.sign=true
shell: bash
- name: Package Linux Distribution
if: matrix.os == 'ubuntu-latest'
run: ./gradlew packageDistributable
- name: Setup MSbuild
if: matrix.os == 'windows-latest'
uses: microsoft/setup-msbuild@v2
- name: Build MSIX
if: matrix.os == 'windows-latest'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/makeappx.exe' pack /d app/desktop/build/msix-workspace /p Tonbrett.msix
- name: Notarize MacOS installer
if: matrix.os == 'macos-14' && startsWith(github.ref, 'refs/tags/')
env:
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
run: ./gradlew notarizeReleasePkg -Pcompose.desktop.mac.sign=true
- name: Upload distributions
uses: actions/upload-artifact@v4
id: upload-artifact
with:
name: desktopapp-${{ matrix.os }}
path: |
*.msix
app/desktop/build/compose/binaries/main-release/deb/*.deb
app/desktop/build/compose/binaries/main-release/pkg/*.pkg
app/desktop/build/distributions/*.tar.gz
- name: Upload MSIX workspace
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: msstore-workspace
path: app/desktop/build/MSStore-msix-workspace/*
build_android_app:
runs-on: ubuntu-latest
name: Build Android App
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{env.JAVA_VERSION}}
- name: Decode Keystore
uses: timheuer/base64-to-file@v1
with:
fileName: 'android_keystore.jks'
fileDir: 'keystore'
encodedString: ${{ secrets.KEYSTORE }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- env:
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
run: ./gradlew :app:android:bundleRelease :app:android:assembleRelease
# https://github.com/r0adkll/sign-android-release/issues/84#issuecomment-1889636075
- name: Setup build tool version variable
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- uses: r0adkll/sign-android-release@v1
id: sign_bundle
name: Sign AAB
with:
releaseDirectory: app/android/build/outputs/bundle/release/
signingKeyBase64: ${{ secrets.KEYSTORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- uses: r0adkll/sign-android-release@v1
id: sign_apk
name: Sign APK
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
with:
releaseDirectory: app/android/build/outputs/apk/release/
signingKeyBase64: ${{ secrets.KEYSTORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: android-app
path: app/android/build/outputs/apk/release/*.apk
# https://github.com/r0adkll/upload-google-play/issues/188
- uses: Abushawish/upload-google-play@master
name: Release on Play Store
if: startsWith(github.ref, 'refs/tags/')
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: dev.schlaubi.tonbrett.android
status: completed
releaseFiles: app/android/build/outputs/bundle/release/tonbrett-app-release.aab
#mappingFile: app/android/build/outputs/mapping/release/mapping.txt
track: alpha
release_to_msstore:
name: Publish to MSStore
runs-on: windows-latest
needs: [ build_desktop_app ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
name: Download Artifacts from Windows
with:
name: msstore-workspace
- name: Setup MSbuild
uses: microsoft/setup-msbuild@v2
- name: Configure the Microsoft Store CLI
run: |
Install-Module -Name StoreBroker -Force
- name: Build MSIX
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/makeappx.exe' pack /d . /p Tonbrett.msix
- name: Upload to MSStore
env:
CLIENT_ID: ${{ secrets.MS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.MS_CLIENT_SECRET }}
run: |
# Login
$user = $Env:CLIENT_ID
$password = ConvertTo-SecureString $Env:CLIENT_SECRET -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential($user, $password)
Set-StoreBrokerAuthentication -TenantId ${{ secrets.MS_TENANT_ID }} -Credential $Cred
$appId = "9P61S67DVWM2"
$global:SBDisableTelemetry = $true
# Create submission package
New-SubmissionPackage -ConfigPath .\submission.json -AppxPath .\Tonbrett.msix -OutPath out -OutName package
# Create new submission
$sub = New-ApplicationSubmission -AppId $appId -Force
# Parse submission meta
$json = (Get-Content out\package.json -Encoding UTF8) | ConvertFrom-Json
# Delete old packages
foreach ($package in $sub.applicationPackages) {
$package.fileStatus = "PendingDelete"
}
# add new packages
$sub.applicationPackages += $json.applicationPackages
# Upload submission meta
Set-ApplicationSubmission -AppId $appId -UpdatedSubmission $sub
# Upload submission package
Set-SubmissionPackage -PackagePath out\package.zip -UploadUrl ($sub.fileUploadUrl)
# Commit changes
Complete-ApplicationSubmission -AppId $appId -SubmissionId ($sub.id)
build_ios_app:
name: Deploy to test flight
runs-on: macos-14
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
working-directory: 'app/ios'
- run: brew install xcodesorg/made/xcodes
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ env.JAVA_VERSION }}
- uses: olegtarasov/get-tag@v2
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
id: tagName
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- run: ./gradlew :app:ios:podInstall :app:ios:linkPodReleaseFrameworkIosArm64
- name: Deploy iOS Beta to TestFlight via Fastlane
uses: maierj/fastlane-action@v3.1.0
with:
subdirectory: app/ios
lane: closed_beta
env:
APP_STORE_CONNECT_TEAM_ID: '${{ secrets.APP_STORE_CONNECT_TEAM_ID }}'
DEVELOPER_APP_ID: '${{ secrets.DEVELOPER_APP_ID }}'
DEVELOPER_APP_IDENTIFIER: '${{ secrets.DEVELOPER_APP_IDENTIFIER }}'
DEVELOPER_PORTAL_TEAM_ID: '${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}'
FASTLANE_APPLE_ID: '${{ secrets.FASTLANE_APPLE_ID }}'
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: '${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}'
MATCH_PASSWORD: '${{ secrets.MATCH_PASSWORD }}'
GIT_AUTHORIZATION: '${{ secrets.GH_CERT_TOKEN }}'
PROVISIONING_PROFILE_SPECIFIER: '${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}'
TEMP_KEYCHAIN_PASSWORD: '${{ secrets.TEMP_KEYCHAIN_PASSWORD }}'
TEMP_KEYCHAIN_USER: '${{ secrets.TEMP_KEYCHAIN_USER }}'
APPLE_KEY_ID: '${{ secrets.APPLE_KEY_ID }}'
APPLE_ISSUER_ID: '${{ secrets.APPLE_ISSUER_ID }}'
APPLE_KEY_CONTENT: '${{ secrets.APPLE_KEY_CONTENT }}'
create_release:
name: Create Release
runs-on: windows-latest # for some weird reason this job does not get picked on ubuntu
needs: [ build_bot_artifacts, build_desktop_app, build_android_app ]
if: startsWith(github.ref, 'refs/tags/')
outputs:
release_id: ${{ steps.release.outputs.id }}
steps:
- uses: actions/download-artifact@v4
name: Download Artifacts from Ubuntu
with:
name: desktopapp-ubuntu-latest
- uses: actions/download-artifact@v4
name: Download Artifacts from MacOS
with:
name: desktopapp-macos-14
- uses: actions/download-artifact@v4
name: Download Bot
with:
name: bot
- uses: actions/download-artifact@v4
name: Download Plugin
with:
name: plugin
- uses: actions/download-artifact@v4
name: Download Android App
with:
name: android-app
- name: Release
uses: softprops/action-gh-release@v2
id: release
with:
files: |
app/desktop/build/compose/binaries/main-release/deb/*.deb
app/desktop/build/compose/binaries/main-release/pkg/*.pkg
app/desktop/build/distributions/*.tar.gz
*.zip
*-signed.apk
sign_windows_binary:
runs-on: windows-latest
needs: [create_release, build_desktop_app]
if: false # waiting on signpath to enable this
steps:
- uses: actions/download-artifact@v4
name: Download Artifacts from Windows
with:
name: desktopapp-windows-latest
path: artifact
- name: Upload Artifact
id: upload-unsigned-artifact
uses: actions/upload-artifact@v4
with:
name: windows-unsigned
path: artifact/*.msix
- uses: SignPath/github-action-submit-signing-request@v0.4
with:
api-token: ${{ secrets.SIGNPATH_KEY }}
organization-id: e6101c42-2f2b-468e-9bf4-225c01ba183f
project-slug: tonbrett
signing-policy-slug: test-signing
artifact-configuration-slug: tonbrett
github-artifact-id: ${{ steps.upload-unsigned-artifact.outputs.artifact_id }}
wait-for-completion-timeout-in-seconds: 36288000 # SignPath needs to manually validate this, so let's give this a week
output-artifact-directory: signed
- name: Edit Release
uses: irongut/EditRelease@v1.2.0
with:
id: ${{ needs.create_release.outputs.release_id }}
files: signed/Tonbrett.msix
token: ${{ secrets.GITHUB_TOKEN }}