Skip to content

Kotlin 2.0, Compose 1.7, and modernize things #333

Kotlin 2.0, Compose 1.7, and modernize things

Kotlin 2.0, Compose 1.7, and modernize things #333

Workflow file for this run

name: Android CI
on:
workflow_dispatch:
push:
branches: [ master, develop, alpha ]
pull_request:
branches: [ master, develop, alpha ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
- uses: gradle/actions/setup-gradle@v4
- name: Write key
run: |
if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then
echo STORE_PASSWORD='${{ secrets.KEY_STORE_PASSWORD }}' >> local.properties
echo KEY_ALIAS='${{ secrets.ALIAS }}' >> local.properties
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties
echo STORE_FILE_PATH='../release.keystore' >> local.properties
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > release.keystore
fi
- name: Build with Gradle
run: ./gradlew assemble
- name: Collect artifcat name
run: |
echo "debug_artifact=$(basename -s .apk app/build/outputs/apk/debug/*.apk)" >> $GITHUB_ENV
echo "release_artifact=$(basename -s .apk app/build/outputs/apk/release/*.apk)" >> $GITHUB_ENV
- name: Upload Debug
uses: actions/upload-artifact@v4
with:
name: ${{ env.debug_artifact }}
path: app/build/outputs/apk/debug/*.apk
- name: Upload Release
uses: actions/upload-artifact@v4
with:
name: ${{ env.release_artifact }}
path: app/build/outputs/apk/release/*.apk
# https://github.com/LSPosed/LSPosed/blob/594604423c548c5a3596dc590f52480db7aabeaf/.github/workflows/core.yml#L112
- name: Post to Telegram
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
env:
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_URL: ${{ github.event.head_commit.url }}
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
export apkRelease=$(find app/build/outputs/apk/release -name "*.apk")
export apkDebug=$(find app/build/outputs/apk/debug -name "*.apk")
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FapkRelease%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FapkDebug%22%2C%22caption%22:${ESCAPED}%7D%5D" -F apkRelease="@$apkRelease" -F apkDebug="@$apkDebug"
fi