Android CI #42
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: | |
| push: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| GHP_TOKEN: ${{ secrets.GHP_TOKEN }} | |
| SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
| SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
| steps: | |
| - name: Checkout repository | |
| 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: Build with Gradle | |
| run: ./gradlew assembleRelease | |
| - name: Install jq | |
| run: sudo apt-get install -y jq | |
| - name: Download package | |
| run: "curl -H 'x-rpc-client_type: 2' -H 'x-rpc-app_version: 2.68.1' -H 'x-rpc-channel: miyousheluodi' https://api-takumi.mihoyo.com/ptolemaios/api/getLatestRelease | jq --raw-output '.data.package_url' | xargs curl -o miyoushe.apk" | |
| - name: Patch package | |
| run: "mkdir out && mv app/build/outputs/apk/release/app-release.apk . && java -jar gradle/lspatch/jar-v0.7.jar -f -l 2 -m app-release.apk -o out miyoushe.apk && mv app-release.apk out" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Artifacts | |
| path: out | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Send to Telegram | |
| run: | | |
| python -m pip install -r .github/scripts/requirements.txt | |
| python .github/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} | |
| - name: Set up Node 16 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 16 | |
| - name: Install dependencies | |
| run: npm install axios@0.27.2 | |
| - name: Run post build script | |
| run: node .github/postbuild.js |