-
Notifications
You must be signed in to change notification settings - Fork 1
203 lines (194 loc) · 7.54 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
name: Artifact CI
on:
push:
env:
JAVA_VERSION: 19
permissions:
contents: write
jobs:
build_bot_artifacts:
name: Build Discord Bot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
- name: Build plugin
uses: gradle/gradle-build-action@v2
with:
arguments: assembleBot
- name: Upload plugin artifact
uses: actions/upload-artifact@v3
with:
name: plugin
path: bot/build/plugin/*.zip
- name: Upload plugin bot
uses: actions/upload-artifact@v3
with:
name: bot
path: bot/build/bot/*.zip
build_desktop_app:
name: Build Desktop App
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{env.JAVA_VERSION}}
- name: Setup MacOS signing
if: matrix.os == 'macos-latest'
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: Build App Distribution
uses: gradle/gradle-build-action@v2
with:
arguments: packageReleaseDistributionForCurrentOS -Pcompose.desktop.mac.sign=true
- name: Setup MSbuild
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Create Code Signing Certificate
if: matrix.os == 'windows-latest'
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WINDOWS_CERTIFICATE }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
- name: Code Sign 2021
if: matrix.os == 'windows-latest'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}' /t http://timestamp.sectigo.com/ /d Tonbrett app/desktop/build/compose/binaries/main-release/msi/*.msi
- name: Notarize MacOS installer
if: matrix.os == 'macos-latest'
uses: gradle/gradle-build-action@v2
env:
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
with:
arguments: notarizeReleasePkg -Pcompose.desktop.mac.sign=true
- name: Upload distributions
uses: actions/upload-artifact@v3
with:
name: desktopapp-${{ matrix.os }}
path: |
app/desktop/build/compose/binaries/main-release/deb/*.deb
app/desktop/build/compose/binaries/main-release/msi/*.msi
app/desktop/build/compose/binaries/main-release/pkg/*.pkg
build_android_app:
runs-on: ubuntu-latest
name: Build Android App
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{env.JAVA_VERSION}}
- name: Decode Keystore
uses: timheuer/[email protected]
with:
fileName: 'android_keystore.jks'
fileDir: 'keystore'
encodedString: ${{ secrets.KEYSTORE }}
- name: Build App Distribution
uses: gradle/gradle-build-action@v2
env:
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
with:
arguments: :app:android:bundleRelease :app:android:assembleRelease
- 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
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@v3
with:
name: android-app
path: app/android/build/outputs/apk/release/*.apk
- uses: r0adkll/upload-google-play@v1
name: Release on Play Store
if: startsWith(github.ref, 'refs/tags/')
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: dev.schlaubi.tonbrett.android
status: draft
releaseFiles: app/android/build/outputs/bundle/release/tonbrett-app-release.aab
mappingFile: app/android/build/outputs/mapping/release/mapping.txt
track: internal
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/')
steps:
- uses: actions/download-artifact@v3
name: Download Artifacts from Ubuntu
with:
name: desktopapp-ubuntu-latest
- uses: actions/download-artifact@v3
name: Download Artifacts from MacOS
with:
name: desktopapp-macos-latest
- uses: actions/download-artifact@v3
name: Download Artifacts from Windows
with:
name: desktopapp-windows-latest
- uses: actions/download-artifact@v3
name: Download Bot
with:
name: bot
- uses: actions/download-artifact@v3
name: Download Plugin
with:
name: plugin
- uses: actions/download-artifact@v3
name: Download Android App
with:
name: android-app
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
deb/*.deb
pkg/*.pkg
msi/*.msi
*.zip
*.apk