mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
chore(workflow): build release APK in separate job
This commit is contained in:
+52
-25
@@ -16,9 +16,10 @@ on:
|
||||
workflow_dispatch: { }
|
||||
|
||||
jobs:
|
||||
build_apk:
|
||||
name: Build APK
|
||||
build_debug_apk:
|
||||
name: Build Debug APK
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.ref != 'refs/heads/main' }}
|
||||
steps:
|
||||
- name: Cancel previous runs
|
||||
uses: styfle/cancel-workflow-action@0.11.0
|
||||
@@ -45,7 +46,6 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Assemble Debug
|
||||
if: ${{ github.ref != 'refs/heads/main' }}
|
||||
run: ./gradlew assembleDebug
|
||||
env:
|
||||
ReleaseAndroidIDE: false
|
||||
@@ -57,13 +57,50 @@ jobs:
|
||||
IDE_SIGNING_URL: ${{ secrets.IDE_SIGNING_URL }}
|
||||
IDE_SIGNING_KEY_BIN: ${{ secrets.IDE_SIGNING_KEY_BIN }}
|
||||
- name: Copy debug APK
|
||||
if: ${{ github.ref != 'refs/heads/main' }}
|
||||
run: cp app/build/outputs/apk/**/debug/*.apk ./
|
||||
- name: Upload arm64-v8a-debug APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-arm64-v8a-debug
|
||||
path: app-arm64-v8a-arm64-v8a-debug.apk
|
||||
- name: Upload armeabi-v7a-debug APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-armeabi-v7a-debug
|
||||
path: app-armeabi-v7a-armeabi-v7a-debug.apk
|
||||
|
||||
build_release_apk:
|
||||
name: Build Release APK
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cancel previous runs
|
||||
uses: styfle/cancel-workflow-action@0.11.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Change Gradle wrapper permissions
|
||||
run: chmod +x ./gradlew
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Assemble Release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
run: ./gradlew assembleRelease
|
||||
env:
|
||||
ReleaseAndroidIDE: true
|
||||
ReleaseAndroidIDE: ${{ github.ref == 'refs/heads/main' }}
|
||||
IDE_SIGNING_ALIAS: ${{ secrets.IDE_SIGNING_ALIAS }}
|
||||
IDE_SIGNING_AUTH_PASS: ${{ secrets.IDE_SIGNING_AUTH_PASS }}
|
||||
IDE_SIGNING_AUTH_USER: ${{ secrets.IDE_SIGNING_AUTH_USER }}
|
||||
@@ -72,32 +109,22 @@ jobs:
|
||||
IDE_SIGNING_URL: ${{ secrets.IDE_SIGNING_URL }}
|
||||
IDE_SIGNING_KEY_BIN: ${{ secrets.IDE_SIGNING_KEY_BIN }}
|
||||
- name: Copy release APK
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
run: cp app/build/outputs/apk/**/release/*.apk ./
|
||||
- name: Upload arm64-v8a-debug APK
|
||||
if: ${{ github.ref != 'refs/heads/main' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-arm64-v8a-debug
|
||||
path: app-arm64-v8a-arm64-v8a-debug.apk
|
||||
- name: Upload armeabi-v7a-debug APK
|
||||
if: ${{ github.ref != 'refs/heads/main' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-armeabi-v7a-debug
|
||||
path: app-armeabi-v7a-armeabi-v7a-debug.apk
|
||||
- name: Upload arm64-v8a-release APK
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-arm64-v8a-release
|
||||
path: app-arm64-v8a-arm64-v8a-release.apk
|
||||
- name: Upload armeabi-v7a-release APK
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: apk-armeabi-v7a-release
|
||||
path: app-armeabi-v7a-armeabi-v7a-release.apk
|
||||
- name: Upload mappings
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: release-mappings
|
||||
path: '**/build/outputs/mapping'
|
||||
|
||||
unit_test_debug:
|
||||
name: Run local tests
|
||||
@@ -197,8 +224,8 @@ jobs:
|
||||
publish:
|
||||
name: Publish release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build_apk, unit_test_debug, unit_test_tooling_api ]
|
||||
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.build_apk.result == 'success' && needs.unit_test_debug.result == 'success' && needs.unit_test_tooling_api.result == 'success' }}
|
||||
needs: [ build_release_apk, unit_test_debug, unit_test_tooling_api ]
|
||||
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.build_release_apk.result == 'success' && needs.unit_test_debug.result == 'success' && needs.unit_test_tooling_api.result == 'success' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -248,8 +275,8 @@ jobs:
|
||||
publish_snapshots:
|
||||
name: Publish package snapshots
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build_apk ]
|
||||
if: ${{ always() && github.ref != 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_apk.result == 'success' }}
|
||||
needs: [ build_debug_apk ]
|
||||
if: ${{ always() && github.ref != 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_debug_apk.result == 'success' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
Reference in New Issue
Block a user