mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
96 lines
2.8 KiB
YAML
96 lines
2.8 KiB
YAML
name: Build for Android
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
sign:
|
|
description: "sign"
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
android:
|
|
name: Release Android
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 代码迁出
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: 构建Java环境
|
|
uses: actions/setup-java@v5
|
|
with:
|
|
distribution: "zulu"
|
|
java-version: "17"
|
|
cache: "gradle"
|
|
cache-dependency-path: |
|
|
android/*.gradle*
|
|
android/**/gradle-wrapper.properties
|
|
|
|
- name: 安装Flutter
|
|
uses: subosito/flutter-action@v2
|
|
id: flutter-action
|
|
with:
|
|
channel: stable
|
|
flutter-version-file: pubspec.yaml
|
|
cache: true
|
|
|
|
- name: apply bottom sheet patch
|
|
working-directory: ${{ env.FLUTTER_ROOT }}
|
|
run: git apply $GITHUB_WORKSPACE/lib/scripts/bottom_sheet_patch.diff
|
|
continue-on-error: true
|
|
|
|
# - name: 下载项目依赖
|
|
# run: flutter pub get
|
|
|
|
- name: Write key
|
|
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_call' && inputs.sign == 'true') }}
|
|
run: |
|
|
if [ ! -z "${{ secrets.SIGN_KEYSTORE_BASE64 }}" ]; then
|
|
echo "${{ secrets.SIGN_KEYSTORE_BASE64 }}" | base64 --decode > android/app/key.jks
|
|
echo storeFile='key.jks' >> android/key.properties
|
|
echo storePassword='${{ secrets.KEYSTORE_PASSWORD }}' >> android/key.properties
|
|
echo keyAlias='${{ secrets.KEY_ALIAS }}' >> android/key.properties
|
|
echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> android/key.properties
|
|
fi
|
|
|
|
- name: Set and Extract version
|
|
shell: pwsh
|
|
run: lib/scripts/build.ps1 android
|
|
|
|
- name: flutter build apk
|
|
run: flutter build apk --release --split-per-abi --dart-define-from-file=pili_release.json --pub
|
|
|
|
- name: rename
|
|
run: |
|
|
for file in build/app/outputs/flutter-apk/app-*-release.apk; do
|
|
abi=$(echo "$file" | sed -E 's|.*app-(.*)-release\.apk|\1|')
|
|
mv "$file" "PiliPlus_android_${{ env.version }}_${abi}.apk"
|
|
done
|
|
shell: bash
|
|
|
|
- name: 上传
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-arm64-v8a
|
|
path: |
|
|
PiliPlus_android_*_arm64-v8a.apk
|
|
|
|
- name: 上传
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-armeabi-v7a
|
|
path: |
|
|
PiliPlus_android_*_armeabi-v7a.apk
|
|
|
|
- name: 上传
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-x86_64
|
|
path: |
|
|
PiliPlus_android_*_x86_64.apk
|