Skip to content

Commit 7b6d198

Browse files
committed
Add GitHub Actions workflow for building and releasing APK
1 parent 05e7d0f commit 7b6d198

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build and Release APK
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version tag for release (e.g., v1.0.0)'
11+
required: true
12+
default: 'v1.0.0'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
cache: gradle
28+
29+
- name: Grant execute permission for gradlew
30+
run: chmod +x gradlew
31+
32+
- name: Build Release APK
33+
run: ./gradlew assembleRelease
34+
35+
- name: Sign APK
36+
uses: r0adkll/sign-android-release@v1
37+
id: sign_app
38+
with:
39+
releaseDirectory: app/build/outputs/apk/release
40+
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
41+
alias: ${{ secrets.KEY_ALIAS }}
42+
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
43+
keyPassword: ${{ secrets.KEY_PASSWORD }}
44+
env:
45+
BUILD_TOOLS_VERSION: "34.0.0"
46+
47+
- name: Get version name
48+
id: version
49+
run: |
50+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
51+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
52+
else
53+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
54+
fi
55+
56+
- name: Rename APK
57+
run: |
58+
mv ${{ steps.sign_app.outputs.signedReleaseFile }} app/build/outputs/apk/release/FrameworkForge-${{ steps.version.outputs.VERSION }}.apk
59+
60+
- name: Create Release
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
tag_name: ${{ steps.version.outputs.VERSION }}
64+
name: FrameworkForge ${{ steps.version.outputs.VERSION }}
65+
body: |
66+
## FrameworkForge ${{ steps.version.outputs.VERSION }}
67+
68+
### What's New
69+
- Built from commit ${{ github.sha }}
70+
71+
### Installation
72+
1. Download the APK below
73+
2. Install on your rooted Android device
74+
3. Grant root permissions when prompted
75+
files: app/build/outputs/apk/release/FrameworkForge-${{ steps.version.outputs.VERSION }}.apk
76+
draft: false
77+
prerelease: false
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Upload APK as Artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: FrameworkForge-APK
85+
path: app/build/outputs/apk/release/FrameworkForge-${{ steps.version.outputs.VERSION }}.apk

0 commit comments

Comments
 (0)