OxygenCustomizer: get #1029
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Nightly APK | |
on: | |
push: | |
branches: [ "beta" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Nightly APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Get application version name | |
run: echo "VERSION_NAME=nightly-$(($(cat app/build.gradle.kts | grep versionCode | tr -s ' ' | cut -d " " -f 4 | tr -d '\r')))" >> $GITHUB_ENV | |
- name: Bump application version code | |
uses: chkfung/[email protected] | |
with: | |
gradlePath: app/build.gradle.kts | |
versionName: "${{ env.VERSION_NAME }} (#${{github.run_number}})" | |
- name: Write sign info | |
if: github.repository == 'DHD2280/Oxygen-Customizer' | |
run: | | |
if [ ! -z "${{ secrets.KEYSTORE }}" ]; then | |
echo storePassword='${{ secrets.KEYSTORE_PASSWORD }}' >> keystore.properties | |
echo keyAlias='${{ secrets.KEY_ALIAS }}' >> keystore.properties | |
echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> keystore.properties | |
echo storeFile='${{ github.workspace }}/key.jks' >> keystore.properties | |
echo ${{ secrets.KEYSTORE }} | base64 --decode > ${{ github.workspace }}/key.jks | |
fi | |
- name: Build with Gradle | |
if: github.repository == 'DHD2280/Oxygen-Customizer' | |
run: ./gradlew assembleRelease | |
- name: Upload a Build Artifact | |
if: github.repository == 'DHD2280/Oxygen-Customizer' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "Oxygen Customizer ${{ env.VERSION_NAME }} Dev (#${{github.run_number}})" | |
path: app/build/outputs/apk/release/*.apk | |
if-no-files-found: error | |
- name: Get commit message header | |
id: get_commit_message | |
run: | | |
COMMIT_MESSAGE_HEADER=$(git log -1 --pretty=%B | head -n 1) | |
echo "COMMIT_MESSAGE_HEADER=${COMMIT_MESSAGE_HEADER}" >> $GITHUB_ENV | |
- name: Zip artifact for deployment | |
run: cd ./app/build/outputs/apk/release/ && zip OxygenCustomizer.zip *.apk -r | |
- name: Telegram File Attachment | |
if: github.repository == 'DHD2280/Oxygen-Customizer' | |
run: | | |
if [[ "$COMMIT_MESSAGE_HEADER" == *. || "$COMMIT_MESSAGE_HEADER" == "CHANGELOG:"* ]]; then | |
if [[ "$COMMIT_MESSAGE_HEADER" == "CHANGELOG:"* ]]; then | |
COMMIT_MESSAGE_HEADER2=$(echo ${COMMIT_MESSAGE_HEADER} | tr -s ':' | cut -d " " -f 2) | |
echo "COMMIT_MESSAGE_HEADER=${COMMIT_MESSAGE_HEADER2}" >> $GITHUB_ENV | |
fi | |
curl -v "https://api.telegram.org/bot${{ secrets.TELEGRAM_TK }}/sendMediaGroup" \ | |
-F chat_id=${{ secrets.OC_NIGHTLY_BUILDS }} \ | |
-F message_thread_id=${{ secrets.OC_NIGHTLY_BUILDS_THREAD }} \ | |
-F media='[{"type":"document", "media":"attach://Xposed", "caption":"Oxygen Customizer ${{ env.VERSION_NAME }} Dev (#${{github.run_number}}) ${{ env.COMMIT_MESSAGE_HEADER }}"}]' \ | |
-F Xposed="@app/build/outputs/apk/release/OxygenCustomizer.zip" | |
fi |