From 75c5fddf7102ea75855398da9b5114a84419cf21 Mon Sep 17 00:00:00 2001 From: Liplum Date: Wed, 20 Nov 2024 14:39:49 +0800 Subject: [PATCH] [workflow] added build-android-release.yml --- .github/workflows/build-android-release.yml | 65 +++++++++++++++++++++ .github/workflows/build.yml | 16 ++--- 2 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build-android-release.yml diff --git a/.github/workflows/build-android-release.yml b/.github/workflows/build-android-release.yml new file mode 100644 index 00000000..253ac0d4 --- /dev/null +++ b/.github/workflows/build-android-release.yml @@ -0,0 +1,65 @@ +name: Flutter Build Android Release + +on: workflow_dispatch + +jobs: + build_android: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + + steps: + - uses: actions/checkout@v4 + with: + repository: plum-tech/mimir-x + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + cache-dependency-path: tools/pnpm-lock.yaml + + - name: Pnpm install + run: | + cd tools && pnpm i && pnpm build && cd .. + + - name: Install JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + flutter-version-file: pubspec.yaml + + - name: Build APK + run: | + flutter config --no-cli-animations + flutter build apk --target-platform android-arm,android-arm64 --split-per-abi + + - name: Sign APK + uses: r0adkll/sign-android-release@v1 + id: sign_apk + with: + releaseDirectory: build/app/outputs/flutter-apk + signingKeyBase64: ${{ secrets.APK_SIGN_JKS_BASE64 }} + keyStorePassword: ${{ secrets.APK_SIGN_JKS_PASSWORD }} + keyPassword: ${{ secrets.APK_SIGN_ALIAS_PASS }} + alias: ${{ secrets.APK_SIGN_ALIAS }} + env: + BUILD_TOOLS_VERSION: "34.0.0" + + - name: Publish Android Artifact + uses: actions/upload-artifact@v4 + with: + name: Android-release + path: build/app/outputs/flutter-apk/*-signed.apk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9f640e4..31e30b62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,11 +28,11 @@ jobs: - name: Pnpm install run: | - cd tools && pnpm i && cd .. + cd tools && pnpm i && pnpm build && cd .. - name: Change version run: | - node tools/increment-build-number.js + pnpm -C tools run increment-build-number - name: Install JDK 17 uses: actions/setup-java@v4 @@ -94,15 +94,15 @@ jobs: - name: Pnpm install run: | - cd tools && pnpm i && cd .. + cd tools && pnpm i && pnpm build && cd .. - name: Change version run: | - node tools/increment-build-number.js + pnpm -C tools run increment-build-number - name: Change Develop to Distribution run: | - node tools/to-distro.js + pnpm -C tools run to-distro - name: Install Apple Certificate uses: apple-actions/import-codesign-certs@v3 @@ -174,13 +174,13 @@ jobs: - name: Pnpm install run: | - cd tools && pnpm i && cd .. + cd tools && pnpm i && pnpm build && cd .. - name: Change version and push tag run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - node tools/increment-build-number.js --push + pnpm -C tools run increment-build-number --push - name: Get iOS Artifact uses: actions/download-artifact@v4 @@ -214,4 +214,4 @@ jobs: env: MIMIR_VERSION_TOKEN: ${{ secrets.MIMIR_VERSION_ADMIN_TOKEN }} run: | - node tools/publish-preview.js --upload build/app-release-signed.apk + pnpm -C tools run publish-preview --upload build/app-release-signed.apk