Build Android App #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: Build Android App | |
on: | |
workflow_dispatch: # 手动触发 | |
push: | |
branches: [ main ] # 如果需要自动触发,可以在这里指定分支 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permissions to gradlew | |
run: chmod +x ./gradlew | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
with: | |
android-version: '34' # 指定 SDK 版本 | |
- name: Build with Gradle | |
run: ./gradlew assembleDebug | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-debug | |
path: app/build/outputs/apk/debug/app-debug.apk |