Skip to content

Commit f654850

Browse files
committed
GitHub Actions workflow
1 parent dece928 commit f654850

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# https://github.com/settings/billing/summary
2+
name: Build and Release APK
3+
4+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
5+
on:
6+
push:
7+
tags:
8+
- "*"
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Check out repository under $GITHUB_WORKSPACE
17+
# https://github.com/actions/checkout
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
# https://github.com/actions/setup-java
22+
- name: Set up Java
23+
uses: actions/setup-java@v4
24+
with:
25+
# https://github.com/actions/setup-java?tab=readme-ov-file#supported-version-syntax
26+
# https://adoptium.net/support/
27+
# https://docs.gradle.org/current/userguide/compatibility.html
28+
distribution: "temurin"
29+
java-version: "21"
30+
cache: "gradle"
31+
32+
# https://developer.android.com/build/building-cmdline
33+
- name: Build APK
34+
run: ./gradlew assembleRelease --no-daemon
35+
36+
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/customizing-github-hosted-runners
37+
- name: Install android tools
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install zipalign apksigner
41+
42+
# https://developer.android.com/build/building-cmdline#sign_cmdline
43+
# https://github.com/caspervk/AndroidAPS-builds/settings/secrets/actions
44+
- name: Sign APK
45+
run: |
46+
cd app/build/outputs/apk/full/release/
47+
echo "$APK_RELEASE_KEY_BASE64" | base64 -d > release-key.jks
48+
zipalign -v -p 4 app-full-release-unsigned.apk app-full-release-unsigned-aligned.apk
49+
apksigner sign --ks release-key.jks --ks-pass pass:"$APK_RELEASE_KEY_PASSWORD" --out "aaps-$REF_NAME.apk" app-full-release-unsigned-aligned.apk
50+
env:
51+
APK_RELEASE_KEY_BASE64: ${{ secrets.APK_RELEASE_KEY_BASE64 }}
52+
APK_RELEASE_KEY_PASSWORD: ${{ secrets.APK_RELEASE_KEY_PASSWORD }}
53+
REF_NAME: ${{ github.ref_name }}
54+
55+
# https://github.com/softprops/action-gh-release
56+
- name: Release APK
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
files: app/build/outputs/apk/full/release/aaps-${{ github.ref_name }}.apk

0 commit comments

Comments
 (0)