Skip to content

Commit 22001cc

Browse files
GHA build to replace (unused) CircleCI
GHA to build debug APK on branches/main and upload signed artifacts to a release when creating a release in GHA. Version number management remains manual. The release upload can't really be tested without running a release so we'll tag a v3.0.8 after merging this to check all's well.
1 parent 48f1544 commit 22001cc

File tree

3 files changed

+62
-47
lines changed

3 files changed

+62
-47
lines changed

.circleci/config.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: build
2+
on:
3+
release:
4+
types: [created]
5+
push:
6+
branches:
7+
- "**"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
if: github.event_name != 'release'
13+
permissions:
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: true
19+
- run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
20+
- run: ./gradlew --no-daemon :app:assembleDebug
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: build
24+
path: ./app/build/outputs/apk/debug/*.apk
25+
retention-days: 3
26+
release:
27+
if: github.event_name == 'release'
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
- run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
36+
- run: echo "SIGNING_STORE_FILE=$RUNNER_TEMP/keystore.jks" >> $GITHUB_ENV
37+
- run: printenv SIGNING_STORE_FILE_BASE64 | base64 -d > "$SIGNING_STORE_FILE"
38+
env:
39+
SIGNING_STORE_FILE_BASE64: ${{ secrets.ANDROID_SIGNING_STORE_FILE_BASE64 }}
40+
- run: ./gradlew --no-daemon :app:assembleRelease :app:bundleRelease
41+
env:
42+
SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
43+
SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
44+
SIGNING_KEY_ALIAS: upload
45+
- run: rm "$SIGNING_STORE_FILE"
46+
- uses: microbit-foundation/[email protected]
47+
with:
48+
file: app/build/outputs/apk/bundle/app-bundle.aab
49+
asset_name: microbit-bundle-${{ env.TAG }}.aab
50+
- uses: microbit-foundation/[email protected]
51+
with:
52+
file: app/build/outputs/apk/release/app-release.apk
53+
asset_name: microbit-release-${{ env.TAG }}.apk

app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ android {
99
// When target SDK version is 30+,
1010
// requestLegacyExternalStorage will continue to work for 29 Android 10
1111
}
12+
signingConfigs {
13+
release {
14+
keyAlias=System.getenv('SIGNING_KEY_ALIAS')
15+
keyPassword=System.getenv('SIGNING_KEY_PASSWORD')
16+
storeFile=System.getenv('SIGNING_STORE_FILE') ? file(System.getenv('SIGNING_STORE_FILE')) : null
17+
storePassword=System.getenv('SIGNING_STORE_PASSWORD')
18+
}
19+
}
1220
buildTypes {
1321
release {
1422
minifyEnabled false
1523
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24+
signingConfig signingConfigs.release
1625
}
1726
}
1827
productFlavors {

0 commit comments

Comments
 (0)