Update dart.yml #16
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: Flutter Windows, Linux, and Android Release | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.x' # 根据需要指定 Flutter 版本 | |
- name: Enable Windows Desktop Support | |
run: flutter config --enable-windows-desktop | |
- name: Add Windows Platform Support | |
run: flutter create --platforms=windows . | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Build Windows Release | |
run: flutter build windows --release | |
- name: Upload Windows Release Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-release | |
path: build/windows/x64/runner/Release/ | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.x' # 根据需要指定 Flutter 版本 | |
- name: Install dependencies for Linux build | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake ninja-build pkg-config libgtk-3-dev liblzma-dev | |
- name: Enable Linux Desktop Support | |
run: flutter config --enable-linux-desktop | |
- name: Add Linux Platform Support | |
run: flutter create --platforms=linux . | |
- name: Install Flutter dependencies | |
run: flutter pub get | |
- name: Build Linux Release | |
run: flutter build linux --release | |
- name: Upload Linux Release Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-release | |
path: build/linux/x64/release/bundle/ | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.x' # 根据需要指定 Flutter 版本 | |
- name: Install Flutter dependencies | |
run: flutter pub get | |
- name: Build Android APK | |
run: flutter build apk --release | |
- name: Upload Android APK Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-apk | |
path: build/app/outputs/flutter-apk/app-release.apk |