Skip to content

Commit

Permalink
tweak GitHub actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Palatis committed May 26, 2023
1 parent ff24784 commit 7449c21
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 31 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/android.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Debug with Gradle
run: ./gradlew assembleDebug --stacktrace
- name: Build Release with Gradle
run: ./gradlew assembleRelease --stacktrace
- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: archive/app/
signingKeyBase64: ${{ secrets.KEYSTORE_JKS_BASE64 }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Rename Signed APKs
run: |
for FILE in archive/app/*unsigned-signed.apk
do
echo "${FILE} -> ${FILE/unsigned-signed/signed}"
mv "${FILE}" "${FILE/unsigned-signed/signed}"
done
- name: Upload
uses: actions/upload-artifact@v3.1.2
with:
name: Build Artifacts
path: |
archive/app/*-signed.apk
archive/app/*-mapping.txt
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
tags:
- 'release-*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease --stacktrace
- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: archive/app/
signingKeyBase64: ${{ secrets.KEYSTORE_JKS_BASE64 }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Rename Signed APKs
run: |
for FILE in archive/app/*unsigned-signed.apk
do
echo "${FILE} -> ${FILE/unsigned-signed/signed}"
mv "${FILE}" "${FILE/unsigned-signed/signed}"
done
- name: Upload
uses: actions/upload-artifact@v3.1.2
with:
name: Build Artifacts
path: |
archive/app/*-signed.apk
archive/app/*-mapping.txt
- name: Release
uses: marvinpinto/action-automatic-releases@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
prerelease: true
files: |
archive/app/*-signed.apk
archive/app/*-mapping.txt
34 changes: 28 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
apply plugin: 'com.android.application'
apply plugin: 'dev.rikka.tools.refine.gradle-plugin'

if (file('signing.gradle').exists()) {
apply from: 'signing.gradle'
} else {
println 'signing.gradle is missing'
}
android {
signingConfigs {
release {
// for custom release signing keys
// 1. create `tw.idv.palatis.XAppDebug.signing.properties` under `~/.gradle`
// 2. populate with these values:
// - STORE_FILE=/path/to/keystore.jks
// - STORE_PASSWORD=super_secret_password
// - KEY_ALIAS=your key alias
// - KEY_PASSWORD=super_secret_password

def propsPath = System.getProperty("user.home") + "/.gradle/tw.idv.palatis.XAppDebug.signing.properties"
def propsFile = file(propsPath)
if (propsFile.canRead()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))

storeFile file(props['STORE_FILE'])
storePassword props['STORE_PASSWORD']
keyAlias props['KEY_ALIAS']
keyPassword props['KEY_PASSWORD']
} else {
println "${propsPath} is missing"
}
}
}

lintOptions {
checkReleaseBuilds false
Expand Down Expand Up @@ -35,7 +56,8 @@ if (file('signing.gradle').exists()) {
versionNameSuffix "-dbg"
}
release {
signingConfig signingConfigs.release
if (signingConfigs.release.storeFile != null)
signingConfig signingConfigs.release
aaptOptions.cruncherEnabled = true
shrinkResources true
minifyEnabled true
Expand Down

0 comments on commit 7449c21

Please sign in to comment.