Workflow file for this run
This file contains hidden or 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 Build and Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" # 仅在推送标签时触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Run tests | |
run: flutter test | |
- name: Build for ${{ matrix.platform }} | |
run: | | |
if [ "${{ matrix.platform }}" == "windows-latest" ]; then | |
flutter build windows | |
elif [ "${{ matrix.platform }}" == "ubuntu-latest" ]; then | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build libgtk-3-dev | |
flutter build linux | |
elif [ "${{ matrix.platform }}" == "macos-latest" ]; then | |
flutter build macos | |
fi | |
android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Run tests | |
run: flutter test | |
- name: Build Android APK | |
run: flutter build apk | |
- name: Build Android App Bundle | |
run: flutter build appbundle | |
web: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Run tests | |
run: flutter test | |
- name: Build for Web | |
run: flutter build web | |
release: | |
runs-on: ubuntu-latest | |
needs: [build, android, web] | |
steps: | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
build/windows/runner/Release/*.exe | |
build/linux/x64/release/bundle/* | |
build/app/outputs/flutter-apk/app-release.apk | |
build/app/outputs/bundle/release/app-release.aab | |
build/web/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHP }} |