generated from dellevin/template
72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
name: Eta Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: android-build-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-apks:
|
|
name: 构建 Debug APK
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 40
|
|
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
|
|
- name: 配置 JDK 25
|
|
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: "25"
|
|
|
|
- name: 配置 Gradle
|
|
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6
|
|
with:
|
|
cache-provider: basic
|
|
|
|
- name: 配置 Android SDK 工具
|
|
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4
|
|
with:
|
|
packages: ""
|
|
log-accepted-android-sdk-licenses: false
|
|
|
|
- name: 安装 Android SDK 37
|
|
run: sdkmanager --channel=3 "platforms;android-37.0"
|
|
|
|
- name: 构建 Debug APK
|
|
run: >-
|
|
./gradlew --no-daemon --no-configuration-cache
|
|
:app:assembleDebug
|
|
|
|
- name: 验证并整理 APK
|
|
id: apk
|
|
run: |
|
|
debug_apk="app/build/outputs/apk/debug/app-debug.apk"
|
|
output_dir="$RUNNER_TEMP/apks"
|
|
|
|
if [[ ! -f "$debug_apk" ]]; then
|
|
echo "::error::未找到 Debug APK。"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$output_dir"
|
|
cp "$debug_apk" "$output_dir/app-debug.apk"
|
|
echo "debug_path=$output_dir/app-debug.apk" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: 上传 Debug APK
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
path: ${{ steps.apk.outputs.debug_path }}
|
|
archive: false
|
|
if-no-files-found: error
|
|
retention-days: 14 |