Skip to content

Commit 560ac76

Browse files
Add GitHub Actions workflow for Test Release 2
1 parent 60480c7 commit 560ac76

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Test Release 2
2+
on:
3+
push:
4+
branches:
5+
- dev2
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Get the source
13+
uses: actions/[email protected]
14+
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v3
17+
with:
18+
distribution: 'temurin'
19+
java-version: '17'
20+
21+
- name: Cache Gradle dependencies
22+
uses: actions/[email protected]
23+
with:
24+
path: |
25+
~/.gradle/caches
26+
~/.gradle/wrapper
27+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
28+
restore-keys: |
29+
${{ runner.os }}-gradle-
30+
31+
- name: Grant execute permission for gradlew
32+
run: chmod +x ./gradlew
33+
34+
- name: Generate Release AAB
35+
run: ./gradlew bundleRelease
36+
37+
- name: Sign AAB with jarsigner
38+
id: sign_aab
39+
env:
40+
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
41+
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
42+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
43+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
44+
run: |
45+
set -e
46+
AAB_SRC="app/build/outputs/bundle/release/app-release.aab"
47+
AAB_DST="app/build/outputs/bundle/release/app-release-signed.aab"
48+
49+
if [ ! -f "$AAB_SRC" ]; then
50+
echo "Error: AAB not found at $AAB_SRC"
51+
exit 1
52+
fi
53+
54+
# Decode the base64 keystore secret into a file
55+
echo "$KEYSTORE_FILE" | base64 --decode > upload-keystore.jks
56+
chmod 600 upload-keystore.jks
57+
58+
# Copy bundle to new file so original remains untouched
59+
cp "$AAB_SRC" "$AAB_DST"
60+
61+
# Sign the AAB
62+
jarsigner -verbose -keystore upload-keystore.jks -storepass "$KEYSTORE_PASSWORD" -keypass "$KEY_PASSWORD" "$AAB_DST" "$KEY_ALIAS"
63+
64+
# Verify signature
65+
jarsigner -verify -verbose -certs "$AAB_DST"
66+
67+
# Clean up keystore file
68+
rm -f upload-keystore.jks
69+
70+
echo "signed_aab=$AAB_DST" >> $GITHUB_OUTPUT
71+
72+
- name: Install curl
73+
run: sudo apt-get update && sudo apt-get install -y curl
74+
75+
- name: Upload signed AAB to Telegram
76+
env:
77+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
78+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
79+
run: |
80+
set -e
81+
SIGNED_AAB="${{ steps.sign_aab.outputs.signed_aab }}"
82+
83+
if [ -z "$SIGNED_AAB" ] || [ ! -f "$SIGNED_AAB" ]; then
84+
echo "Signed AAB not found: $SIGNED_AAB"
85+
exit 1
86+
fi
87+
88+
echo "Uploading signed AAB: $SIGNED_AAB"
89+
curl -s -X POST "https://api.telegram.org/bot${{ env.TELEGRAM_BOT_TOKEN }}/sendDocument" \
90+
-F chat_id=${{ env.TELEGRAM_CHAT_ID }} \
91+
-F document=@"$SIGNED_AAB"

0 commit comments

Comments
 (0)