From 69d37952718cbdefc1ff936cbf5de431d9831e7a Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:27:34 +0800 Subject: [PATCH] CI script --- .github/workflows/build-publish.yml | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/build-publish.yml diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml new file mode 100644 index 00000000..b7c0a017 --- /dev/null +++ b/.github/workflows/build-publish.yml @@ -0,0 +1,69 @@ +name: build & publish + +on: + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: + branches: + - '**' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + build_type: [debug, release] + include: + - build_type: debug + build_param: assembleDebug + target_path: ./mobile/build/outputs/apk/debug/ssrdroid-debug.apk + - build_type: release + build_param: assembleRelease + target_path: ./mobile/build/outputs/apk/release/ssrdroid-release.apk + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Check out submodules + run: git submodule update --init --recursive + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - name: Install Rust targets + run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Set up Android NDK + run: sdkmanager --install "ndk;25.1.8937393" + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: | + echo "==== Build type: ${{ matrix.build_type }} ====" + ./gradlew ${{ matrix.build_param }} + + - name: Publish Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: ${{ matrix.target_path }}