Update #1274
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: | |
| workflow_dispatch: | |
| inputs: | |
| UPAPK: | |
| description: 'Release APK' | |
| type: boolean | |
| default: false | |
| UPTG: | |
| description: 'Send Telegram' | |
| type: boolean | |
| default: false | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: write-all | |
| env: | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| CHAT_ID: ${{ secrets.CHAT_ID }} | |
| TG_TOKEN: ${{ secrets.TG_TOKEN }} | |
| UPAPK: ${{ inputs.UPAPK }} | |
| UPTG: ${{ inputs.UPTG }} | |
| jobs: | |
| build-release: | |
| if: ${{ github.repository_owner == 'Zenlua' }} | |
| runs-on: ubuntu-latest | |
| environment: Stable | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-cache-release | |
| - name: Build APK | |
| run: | | |
| chmod +x ./gradlew ./.github/modun.sh | |
| ./.github/modun.sh | |
| ./gradlew assembleRelease -x lint -x test | |
| VER=$(grep -m1 'versionName ' app/build.gradle | cut -d'"' -f2) | |
| echo "Tool-Tree $VER" | |
| echo "VER=$VER" >> $GITHUB_ENV | |
| mkdir -p Up Beta | |
| cp -rf app/build/outputs/apk/*/*.apk "Up/Tool-Tree.$VER.apk" | |
| cp -rf app/build/outputs/apk/*/*.apk "Beta/Tool-Tree-beta.apk" | |
| ls Up | |
| echo -e "- \n- See version notes: [Changelog](https://zenlua.github.io/Tool-Tree/Version.html)" > change.txt | |
| if [ "$UPTG" == "true" ];then | |
| echo "Telegram" | |
| chat_tg="https://github.com/Zenlua/Tool-Tree/releases/latest | |
| 🎉 Release new version Tool-Tree | |
| • Notes: <a href=\"https://zenlua.github.io/Tool-Tree/Version.html\">Changelog</a> | |
| • Version: $VER" | |
| # tooltree | |
| curl -s -X POST "https://api.telegram.org/bot$TG_TOKEN/sendMessage" \ | |
| -d chat_id="$CHAT_ID" -d parse_mode="HTML" \ | |
| --data-urlencode text="$chat_tg" | |
| fi | |
| - name: Beta APK | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "Tool-Tree ${{ env.VER }} Beta" | |
| tag_name: "beta" | |
| files: Beta/* | |
| prerelease: true | |
| - name: Release APK | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.UPAPK == true }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "Tool-Tree ${{ env.VER }}" | |
| tag_name: "V${{ env.VER }}" | |
| files: Up/* | |
| prerelease: false | |
| body_path: "change.txt" | |
| build-debug: | |
| runs-on: ubuntu-latest | |
| environment: Debug | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-cache-debug | |
| - name: Build APK | |
| run: | | |
| chmod +x ./gradlew ./.github/modun.sh | |
| ./.github/modun.sh | |
| ./gradlew assembleDebug -x lint -x test | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-apk | |
| path: app/build/outputs/apk/*/*.apk | |