Skip to content

修改Action分支错误 #2

修改Action分支错误

修改Action分支错误 #2

name: zaix-app-build-action
#推送Tag时触发
on:
push:
tags:
- "zaix/*"
jobs:
# MACOS 镜像
build-mac-ios-android:
runs-on: macos-latest
permissions:
contents: write
steps:
# 1.1 签出代码
- uses: actions/checkout@v3
with:
ref: zaimanhua
# 1.2 写出相关签名
- name: Get Android Keystore
id: android_keystore
uses: timheuer/[email protected]
with:
fileName: keystore.jks
encodedString: ${{ secrets.ZAI_KEYSTORE_BASE64 }}
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/zai_key.properties
echo "storePassword=${{ secrets.ZAI_STORE_PASSWORD }}" >> android/zai_key.properties
echo "keyPassword=${{ secrets.ZAI_KEY_PASSWORD }}" >> android/zai_key.properties
echo "keyAlias=${{ secrets.ZAI_KEY_ALIAS }}" >> android/zai_key.properties
# 1.2 设置JAVA环境
- name: Setup JAVA
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
# 1.3 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.x"
cache: true
- name: Enable Flutter Desktop
run: flutter config --enable-macos-desktop
# 1.4 更新Flutter的packages
- name: Restore Packages
run: flutter pub get
# 1.5 安装appdmg npm install -g appdmg
- name: Install appdmg
run: npm install -g appdmg
# 1.6 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# 1.7 build APK
- name: Build APK
run: flutter build apk --release
# 1.8 build IOS
- name: Build IPA
run: flutter build ios --release --no-codesign
# 1.9 创建一个未签名IPA
- name: Create IPA
run: |
mkdir build/ios/iphoneos/Payload
cp -R build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/Runner.app
cd build/ios/iphoneos/
zip -q -r ios_no_sign.ipa Payload
cd ../../..
# 1.10 build MAC ZIP\DMG
- name: Build MacOS
run: flutter_distributor package --platform macos --targets dmg,zip --skip-clean
# 1.11 上传APK\IPA\MAC DMG\ZIP
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
body_path: document/RELEASE.txt
token: ${{secrets.TOKEN }}
files: |
build/app/outputs/flutter-apk/app-release.apk
build/ios/iphoneos/ios_no_sign.ipa
build/dist/*/*.dmg
build/dist/*/*.zip
#完成
- run: echo "🍏 MacOS job's status is ${{ job.status }}."
# Linux 镜像
build-linux:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
# 2.1 签出代码
- uses: actions/checkout@v3
with:
ref: zaimanhua
# 2.2 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.x"
cache: true
- name: Update apt-get
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
- name: Enable Flutter Desktop
run: flutter config --enable-linux-desktop
- name: Restore Packages
run: flutter pub get
# 2.3 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# 2.4 build Linux ZIP\DMG
- name: Build Linux
run: flutter_distributor package --platform linux --targets deb,zip --skip-clean
# 2.5 上传ZIP\DMG
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
body_path: document/RELEASE.txt
token: ${{secrets.TOKEN }}
files: |
build/dist/*/*.deb
build/dist/*/*.zip
#完成
- run: echo "🍏 Linux job's status is ${{ job.status }}."
# Windows 镜像
build-windows:
runs-on: windows-latest
permissions:
contents: write
steps:
# 3.1 签出代码
- uses: actions/checkout@v3
with:
ref: zaimanhua
# 3.2 设置Flutter环境
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.x"
cache: true
- name: Enable Flutter Desktop
run: flutter config --enable-windows-desktop
- name: Restore Packages
run: flutter pub get
# 3.3 设置flutter_distributor环境
- name: Install flutter_distributor
run: dart pub global activate flutter_distributor
# 3.4 build Windows ZIP\MSIX
- name: Build Windows
run: flutter_distributor package --platform windows --targets msix,zip --skip-clean
# 3.5 上传ZIP\MSIX
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
body_path: document/RELEASE.txt
token: ${{secrets.TOKEN }}
files: |
build/dist/*/*.msix
build/dist/*/*.zip
#完成
- run: echo "🍏 Windows job's status is ${{ job.status }}."