Skip to content

Commit fad5c58

Browse files
committed
CI: Add Android Release CI workflow
1 parent e9f2b02 commit fad5c58

File tree

3 files changed

+71
-5
lines changed

3 files changed

+71
-5
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Android Release CI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
18+
- name: set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: gradle
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Write key
29+
run: |
30+
echo KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} > signing.properties
31+
echo KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }} >> signing.properties
32+
echo KEYSTORE_ALIAS_PASSWORD='${{ secrets.KEYSTORE_ALIAS_PASSWORD }}' >> signing.properties
33+
echo KEYSTORE_FILE=../key.jks >> signing.properties
34+
echo ${{ secrets.KEYSTORE }} | base64 --decode > key.jks
35+
36+
- name: Build Release
37+
run: ./gradlew assembleUniversalRelease
38+
39+
- run: |
40+
cd app/build/outputs/apk/universal/release/
41+
mv app-universal-release.apk ReVancedXposed-${{ github.ref_name }}.apk
42+
gh release create --prerelease ${{ github.ref_name }} ReVancedXposed-${{ github.ref_name }}.apk
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
.externalNativeBuild
1515
.cxx
1616
local.properties
17-
.kotlin
17+
.kotlin
18+
19+
*.jks
20+
*.keystore
21+
signing.properties

app/build.gradle.kts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import groovy.xml.MarkupBuilder
22
import groovy.xml.XmlSlurper
33
import groovy.xml.slurpersupport.NodeChild
44
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
5+
import java.util.Properties
6+
import kotlin.apply
57

68
plugins {
79
alias(libs.plugins.android.application)
@@ -46,6 +48,21 @@ android {
4648
)
4749
)
4850
}
51+
val ksFile = rootProject.file("signing.properties")
52+
signingConfigs {
53+
if (ksFile.exists()) {
54+
create("release") {
55+
val properties = Properties().apply {
56+
ksFile.inputStream().use { load(it) }
57+
}
58+
59+
storePassword = properties["KEYSTORE_PASSWORD"] as String
60+
keyAlias = properties["KEYSTORE_ALIAS"] as String
61+
keyPassword = properties["KEYSTORE_ALIAS_PASSWORD"] as String
62+
storeFile = file(properties["KEYSTORE_FILE"] as String)
63+
}
64+
}
65+
}
4966
buildFeatures.buildConfig = true
5067
buildTypes {
5168
release {
@@ -54,7 +71,8 @@ android {
5471
proguardFiles(
5572
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
5673
)
57-
signingConfig = signingConfigs.getByName("debug")
74+
if (ksFile.exists())
75+
signingConfig = signingConfigs.getByName("release")
5876
}
5977
}
6078
compileOptions {
@@ -75,9 +93,9 @@ android {
7593
getByName("main") {
7694
java {
7795
srcDirs(
78-
"../revanced-patches/extensions/shared/library/src/main/java",
79-
"../revanced-patches/extensions/youtube/src/main/java",
80-
"../revanced-patches/extensions/spotify/src/main/java"
96+
"../revanced-patches/extensions/shared/library/src/main/java",
97+
"../revanced-patches/extensions/youtube/src/main/java",
98+
"../revanced-patches/extensions/spotify/src/main/java"
8199
)
82100
}
83101
}

0 commit comments

Comments
 (0)