init #5
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: "BiliRoamingX/BiliRoamingX" | |
ref: "v1.24.1" | |
submodules: "recursive" | |
- name: Checkout patches | |
uses: actions/checkout@v4 | |
with: | |
path: customPatches | |
- name: Apply custom patches | |
run: | | |
cat $(ls ./customPatches/*.patch | sort) | git apply -v | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Retrieve version | |
run: | | |
version=`awk -F "=" '$1 == "version" {print $2}' gradle.properties` | |
commit_count=`git rev-list HEAD --count` | |
version="${version}.r${commit_count}" | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Build with gradle | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: ./gradlew --no-daemon -Dorg.gradle.jvmargs=-Xmx2g -Pversion=$VERSION dist | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: build | |
integrate: | |
name: Integrate | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
merge-multiple: 'true' | |
- name: Download revanced-cli | |
run: wget https://github.com/zjns/revanced-cli/releases/latest/download/revanced-cli.jar | |
- name: Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: bilibili-8.14.0.apk | |
key: bilibili-8.14.0 | |
- name: Retrive Bilibili-8.14.0 | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
wget -O bilibili-8.14.0.apk https://android-apps.pp.cn/fs08/2024/09/19/7/110_e45d2a32e0ab2f09ad89083b0804c561.apk | |
- name: Integrate | |
run: | | |
java -jar revanced-cli.jar patch --merge $(ls *integrations*.apk) --patch-bundle $(ls *patches*.jar) --signing-levels 1,2,3 bilibili-8.14.0.apk | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: integrate | |
path: "*patched.apk" | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: integrate | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
attestations: write | |
steps: | |
- name: Download APK from integrate | |
uses: actions/download-artifact@v4 | |
with: | |
name: integrate | |
merge-multiple: true | |
- name: Download JAR from build | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
merge-multiple: true | |
- name: Publish release | |
id: publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
* | |
- name: Attest Release Files | |
id: attest | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: | | |
* |