GetToken/.github/workflows/android.yml

50 lines
1.6 KiB
YAML
Raw Normal View History

2022-11-22 09:16:08 +00:00
name: Android CI
on:
2022-11-23 04:31:13 +00:00
workflow_dispatch:
2022-11-22 09:16:08 +00:00
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
2022-11-23 02:03:50 +00:00
build:
2022-11-22 09:16:08 +00:00
runs-on: ubuntu-latest
2022-11-23 02:26:34 +00:00
env:
2022-11-23 06:30:13 +00:00
GHP_TOKEN: ${{ secrets.GHP_TOKEN }}
2022-11-23 02:26:34 +00:00
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
2022-11-22 09:16:08 +00:00
steps:
2022-11-23 04:31:13 +00:00
- name: Checkout repository
uses: actions/checkout@v3
2022-11-22 09:16:08 +00:00
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease
2022-11-23 04:31:13 +00:00
- name: Install jq
run: sudo apt-get install -y jq
2022-11-22 09:16:08 +00:00
- name: Download package
2022-11-23 06:30:13 +00:00
run: "curl -H 'x-rpc-client_type: 2' -H 'x-rpc-app_version: 2.37.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"
2022-11-22 09:16:08 +00:00
- name: Patch package
2022-11-23 06:30:13 +00:00
run: "mkdir out && mv app/build/outputs/apk/release/app-release.apk . && java -jar gradle/lspatch/jar-v0.5.1-361-release.jar -f -l 2 -m app-release.apk -o out miyoushe.apk && mv app-release.apk out"
2022-11-22 09:16:08 +00:00
- name: Upload build artifacts
2022-11-22 09:26:19 +00:00
uses: actions/upload-artifact@v3.1.0
2022-11-22 09:16:08 +00:00
with:
name: Artifacts
2022-11-23 04:31:13 +00:00
path: out
2022-11-23 06:30:13 +00:00
- name: Set up Node 16
2022-11-23 06:31:06 +00:00
uses: actions/setup-node@v3
with:
node-version: 16
2022-11-23 06:30:13 +00:00
- name: Install dependencies
run: npm install axios@0.27.2
- name: Run post build script
run: node .github/postbuild.js