This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
Refactor : hosting app #1
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: Android CI | |
on: | |
push: | |
branches: [ "**" ] | |
paths-ignore: | |
- '**/*.md' | |
pull_request: | |
branches: [ "**" ] | |
paths-ignore: | |
- '**/*.md' | |
workflow_dispatch: | |
jobs: | |
init: | |
name: Init | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: notify telegram | |
uses: EverythingSuckz/github-telegram-notify@main | |
continue-on-error: true | |
with: | |
bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
chat_id: -1002355760766 | |
topic_id: 11 | |
build_release_apk: | |
name: Build App Release APK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'oracle' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Validate Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Build with Gradle | |
id: gradle_build_release | |
run: ./gradlew assembleRelease | |
- name: Upload release apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release | |
path: app/build/outputs/apk/release/app-release.apk | |
send_release_apk: | |
name: Send Release APK | |
runs-on: ubuntu-latest | |
needs: build_release_apk | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Download release apk | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-release | |
- name: List repo contents | |
run: ls | |
- name: Get the last commit message | |
id: get_commit_msg | |
run: | | |
commit_message=$(git log -1 --pretty=format:'%s') | |
echo "message=$commit_message" >> $GITHUB_OUTPUT | |
- name: Rename file | |
run: | | |
mv app-release.apk sparkles-app-release.apk | |
ls | |
- name: Send APK to Release Channel Telegram with Topic ID | |
if: success() | |
continue-on-error: true | |
run: | | |
curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \ | |
-F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \ | |
-F message_thread_id="11" \ | |
-F document=@"sparkles-app-release.apk" \ | |
-F caption="${{ github.event.head_commit.message }} by ${{ github.actor }}" |