feat. add workflow #1
This file contains hidden or 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: | |
| - main | |
| - dev | |
| paths-ignore: | |
| - '**/*.md' | |
| workflow_dispatch: | |
| jobs: | |
| build-release: | |
| name: Build Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Decode and create xed.keystore | |
| run: echo "${{ secrets.KEYSTORE }}" | base64 -d > /tmp/xed.keystore | |
| - name: Decode and create signing.properties | |
| run: echo "${{ secrets.PROP }}" | base64 -d > /tmp/signing.properties | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Set Commit Hash | |
| id: commit_hash | |
| run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Build with Gradle | |
| run: ./gradlew assembleRelease && mv app/build/outputs/apk/release/*.apk app/taskmanager-${{ env.COMMIT_HASH }}.apk | |
| env: | |
| KEYSTORE_FILE: /tmp/xed.keystore | |
| SIGNING_PROPERTIES_FILE: /tmp/signing.properties | |
| continue-on-error: false | |
| - name: Archive APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: TaskManager-Release | |
| path: app/taskmanager-${{ env.COMMIT_HASH }}.apk | |
| - name: Delete xed.keystore and signing.properties | |
| run: rm /tmp/xed.keystore /tmp/signing.properties | |
| - name: Send APK to Telegram | |
| if: ${{ success() && github.event.head_commit.message != '' }} | |
| run: | | |
| curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT }}/sendDocument" \ | |
| -F chat_id="-1002292589492" \ | |
| -F message_thread_id="116" \ | |
| -F caption="${{ github.event.head_commit.message }} by ${{ github.actor }}" \ | |
| -F document=@"app/taskmanager-${{ env.COMMIT_HASH }}.apk" |