-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (51 loc) · 1.89 KB
/
release.yml
File metadata and controls
62 lines (51 loc) · 1.89 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
name: Build & Release APK
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0
jobs:
build:
name: Build & Sign Release APK
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Decode Keystore from Secret
run: |
echo "${{ secrets.SIGNING_KEY }}" | base64 -d > app/release-key.jks
- name: Grant execute permission for Gradle
run: chmod +x ./gradlew
- name: Build release APK and AAB
run: ./gradlew bundleRelease assembleRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_KEY_STORE_PASSWORD: ${{ secrets.SIGNING_KEY_STORE_PASSWORD }}
- name: Rename output files with version
run: |
TAG_NAME="${GITHUB_REF##*/}" # e.g. v1.0.0
mv app/build/outputs/apk/release/app-release.apk "zapri-${TAG_NAME}.apk"
mv app/build/outputs/bundle/release/app-release.aab "zapri-${TAG_NAME}.aab"
- name: Extract changelog for release
id: changelog
run: |
TAG_NAME="${GITHUB_REF##*/}"
echo "Reading changelog for tag $TAG_NAME..."
CHANGELOG=$(awk "/## \\[?${TAG_NAME#v}\\]?/ {flag=1; next} /^## /{flag=0} flag" app/CHANGELOG.md)
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Upload APK and AAB to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
zapri-v*.apk
zapri-v*.aab
body: ${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}