Release 3.9.2 #535
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 CI | |
on: | |
push: | |
branches: [ master, rCompatible, rCompatible-Dev ] | |
workflow_dispatch: | |
concurrency: | |
group: 'ci-build' | |
cancel-in-progress: true | |
jobs: | |
buildMaster: | |
name: Build Ci APK from master | |
if: startsWith(github.ref, 'refs/heads/master') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r26b | |
- name: Get Commit Message | |
id: commitMessage | |
run: IN="${{ github.event.head_commit.message }}" && echo "message=${IN%%$'\n'*}" >> $GITHUB_OUTPUT | |
- name: Setup JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 20 | |
distribution: temurin | |
- name: Cache Gradle dependencies | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Cache build cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
${{ github.workspace }}/.ccache | |
~/.gradle/caches/build-cache-* | |
key: ${{ runner.os }}-build-cache-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-cache- | |
- name: Extract branch name | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: File Permissions | |
run: chmod +x gradlew | |
- name: Accept Preview SDK License | |
run: echo -n -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > /usr/local/lib/android/sdk/licenses/android-sdk-preview-license | |
- name: Build apk | |
id: buildAllApks | |
uses: gradle/[email protected] | |
with: | |
gradle-version: wrapper | |
arguments: assembleDebug | |
- name: Get JSON | |
id: metadataJson | |
run: | | |
echo "json=$(cat app/build/outputs/apk/debug/output-metadata.json | jq -c .)" >> $GITHUB_OUTPUT | |
- name: Sign artifact | |
id: signArtifact | |
uses: ilharp/[email protected] | |
with: | |
releaseDir: app/build/outputs/apk/debug | |
keyAlias: ${{ secrets.KEYALIAS }} | |
signingKey: ${{ secrets.SIGNING_KEY }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
buildToolsVersion: 34.0.0 | |
- name: Delete old APK | |
run: rm app/build/outputs/apk/debug/app-debug.apk | |
- name: Rename APK | |
run: mv app/build/outputs/apk/debug/app-debug-signed.apk app/build/outputs/apk/debug/app-debug.apk | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: Debug Artifact | |
path: app/build/outputs/apk/debug/app-debug.apk | |
- name: Create new Release | |
id: create_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }}-debug | |
prerelease: true | |
title: Rboard Manager Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }} | |
files: | | |
app/build/outputs/apk/debug/app-debug.apk | |
app/build/outputs/apk/debug/output-metadata.json | |
- name: Create new Release | |
id: create_latest_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest-debug | |
prerelease: true | |
title: Rboard Manager Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }} | |
files: | | |
app/build/outputs/apk/debug/app-debug.apk | |
app/build/outputs/apk/debug/output-metadata.json | |
- name: Send Telegram message | |
run: "curl --location --request POST 'https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage' --header 'Content-Type:application/json' --data-raw '{\"chat_id\":\"${{ secrets.TELEGRAM_TO_MAIN }}\",\"message_thread_id\":${{ secrets.TELEGRAM_MAIN_TOPIC_ID_DEBUG }},\"text\":\"#A12\\n**${{ steps.extract_branch.outputs.BRANCH_NAME }}**\\n\\ncommit: `${{ github.event.head_commit.message }}` [${{ github.event.head_commit.id }}](${{ github.event.head_commit.url }})\",\"parse_mode\":\"markdown\",\"reply_markup\":{\"inline_keyboard\":[[{\"text\":\"Download A12+\",\"url\":\"https://github.com/DerTyp7214/RboardThemeManagerV3/releases/download/${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }}-debug/app-debug.apk\"}]]}}'" | |
- name: Send Notification | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://fcm.googleapis.com/fcm/send' | |
method: 'POST' | |
customHeaders: '{"Authorization":"key=${{ secrets.FCM_KEY }}"}' | |
data: '{"to": "/topics/update-v3-debug","data": {"version": ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionCode }},"type": "update","notification": {"body": "Update available. ${{ steps.commitMessage.outputs.message }}","title": "Update"}}}' |