-
Notifications
You must be signed in to change notification settings - Fork 0
319 lines (275 loc) · 11.9 KB
/
release.yml
File metadata and controls
319 lines (275 loc) · 11.9 KB
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
name: Release Build
on:
push:
branches:
- release
jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: yarn install
- name: Get version from package.json
id: version
shell: bash
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Check signing configuration
shell: bash
run: |
if [ -n "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" ]; then
echo "✓ TAURI_SIGNING_PRIVATE_KEY is set (length: ${#TAURI_SIGNING_PRIVATE_KEY})"
else
echo "✗ TAURI_SIGNING_PRIVATE_KEY is NOT set"
fi
if [ -n "${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}" ]; then
echo "✓ TAURI_SIGNING_PRIVATE_KEY_PASSWORD is set"
else
echo "✗ TAURI_SIGNING_PRIVATE_KEY_PASSWORD is NOT set"
fi
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- name: Extract changelog for this version
id: changelog
shell: bash
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Extract the section for this version from CHANGELOG.md
# Finds content between ## [VERSION] and the next ## [
CHANGELOG=$(awk "/## \[${VERSION}\]/{flag=1; next} /## \[/{flag=0} flag" CHANGELOG.md)
# Output to GitHub Actions in multiline format
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "Extracted changelog:"
echo "$CHANGELOG"
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }}
PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
with:
tagName: v${{ steps.version.outputs.VERSION }}
releaseName: 'Dota Keeper v${{ steps.version.outputs.VERSION }}'
releaseBody: ${{ steps.changelog.outputs.CHANGELOG }}
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
- name: Verify signature files were created
shell: bash
run: |
echo "Checking for .sig files in target directory..."
find src-tauri/target -name "*.sig" -type f || echo "No .sig files found"
echo ""
echo "Listing all files in bundle directories:"
find src-tauri/target -type d -name "bundle" -exec sh -c 'echo "=== {} ==="; ls -la "{}" 2>/dev/null || true' \;
echo ""
echo "Searching for any signature-related files:"
find src-tauri/target -type f \( -name "*.sig" -o -name "*signature*" \) 2>/dev/null || echo "No signature files found"
- name: List all release assets
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Listing all assets in the draft release..."
gh release view "v${{ steps.version.outputs.VERSION }}" --json assets --jq '.assets[].name' || echo "Could not list release assets"
android:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust stable + Android targets
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Install Android NDK r27
run: |
"$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --install "ndk;27.0.12077973"
echo "NDK_HOME=$ANDROID_SDK_ROOT/ndk/27.0.12077973" >> $GITHUB_ENV
- name: Install frontend dependencies
run: yarn install
- name: Create cargo-tauri wrapper
run: |
printf '#!/bin/sh\nshift\nexec yarn tauri "$@"\n' > ~/.cargo/bin/cargo-tauri
chmod +x ~/.cargo/bin/cargo-tauri
- name: Get version from package.json
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Decode keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > "$RUNNER_TEMP/release.keystore"
- name: Build release AAB
env:
NDK_HOME: ${{ env.NDK_HOME }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }}
PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
run: yarn tauri android build --aab true
- name: Sign AAB
run: |
UNSIGNED=$(find src-tauri/gen/android/app/build/outputs/bundle -name "*.aab" | head -1)
SIGNED="dota-keeper-${{ steps.version.outputs.VERSION }}-android.aab"
jarsigner -verbose \
-sigalg SHA256withRSA \
-digestalg SHA-256 \
-keystore "$RUNNER_TEMP/release.keystore" \
-storepass "${{ secrets.ANDROID_STORE_PASSWORD }}" \
-keypass "${{ secrets.ANDROID_KEY_PASSWORD }}" \
-signedjar "$SIGNED" \
"$UNSIGNED" \
"${{ secrets.ANDROID_KEY_ALIAS }}"
echo "SIGNED_AAB=$SIGNED" >> $GITHUB_ENV
- name: Upload AAB as workflow artifact
uses: actions/upload-artifact@v4
with:
name: dota-keeper-${{ steps.version.outputs.VERSION }}-android
path: ${{ env.SIGNED_AAB }}
retention-days: 30
- name: Upload to Google Play (internal track, draft)
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.dotakeeper.dotakeeper.beta
releaseFiles: ${{ env.SIGNED_AAB }}
track: internal
status: draft
update-release-json:
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: release
- name: Get version from package.json
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Download and inspect release signatures
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
echo "=== Release assets for v${VERSION} ==="
gh release view "v${VERSION}" --json assets --jq '.assets[].name' || echo "Could not list assets"
mkdir -p ./signatures
# Download all .sig files
echo ""
echo "=== Downloading .sig files ==="
gh release download "v${VERSION}" --pattern "*.sig" --dir ./signatures 2>&1 || \
echo "Warning: gh release download failed or no .sig files found"
echo ""
echo "=== Downloaded signature files ==="
ls -la ./signatures/ 2>/dev/null || echo "No files downloaded"
- name: Update latest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
PUB_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
WIN_SIG=""
LINUX_SIG=""
MACOS_X64_SIG=""
MACOS_ARM_SIG=""
# Classify each downloaded .sig file by its name.
# Order matters: aarch64 before x64, amd64 before x64, .app.tar.gz before plain x64.
for f in ./signatures/*.sig; do
[ -f "$f" ] || continue
name=$(basename "$f")
echo "Classifying: $name"
case "$name" in
*aarch64*) MACOS_ARM_SIG=$(cat "$f"); echo " → macOS ARM" ;;
*amd64*) LINUX_SIG=$(cat "$f"); echo " → Linux x64" ;;
*x64.app.tar.gz.sig) MACOS_X64_SIG=$(cat "$f"); echo " → macOS x64" ;;
*x64*) WIN_SIG=$(cat "$f"); echo " → Windows x64" ;;
*) echo " → unrecognised, skipping" ;;
esac
done
echo ""
echo "Windows sig present: $([ -n "$WIN_SIG" ] && echo yes || echo NO)"
echo "Linux sig present: $([ -n "$LINUX_SIG" ] && echo yes || echo NO)"
echo "macOS x64 sig present: $([ -n "$MACOS_X64_SIG" ] && echo yes || echo NO)"
echo "macOS ARM sig present: $([ -n "$MACOS_ARM_SIG" ] && echo yes || echo NO)"
mkdir -p meta/autoupdate
cat > meta/autoupdate/latest.json << EOF
{
"version": "${VERSION}",
"notes": "Release v${VERSION}",
"pub_date": "${PUB_DATE}",
"platforms": {
"windows-x86_64": {
"signature": "${WIN_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_${VERSION}_x64_en-US.msi"
},
"linux-x86_64": {
"signature": "${LINUX_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_${VERSION}_amd64.AppImage.tar.gz"
},
"darwin-x86_64": {
"signature": "${MACOS_X64_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_x64.app.tar.gz"
},
"darwin-aarch64": {
"signature": "${MACOS_ARM_SIG}",
"url": "https://github.com/stringhandler/dota-keeper/releases/download/v${VERSION}/Dota.Keeper_aarch64.app.tar.gz"
}
}
}
EOF
echo ""
echo "=== Generated latest.json ==="
cat meta/autoupdate/latest.json
- name: Commit latest.json to repo
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add meta/autoupdate/latest.json
git diff --cached --quiet || git commit -m "chore: update latest.json for v${{ steps.version.outputs.VERSION }}"
git push
- name: Upload latest.json to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
gh release upload "v${VERSION}" meta/autoupdate/latest.json --clobber