Merge pull request #38 from OctagonalStar/feat/add-noification #105
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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-android: | |
| name: Build Android APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: '3.35.5' | |
| - name: Decode keystore | |
| run: | | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/release.jks | |
| echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" > android/key.properties | |
| echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties | |
| echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties | |
| echo "storeFile=../release.jks" >> android/key.properties | |
| - run: flutter pub get | |
| - run: flutter build apk --release --obfuscate --split-per-abi --split-debug-info=symbols | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-arm-v7a-apk | |
| path: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-arm-v8a-apk | |
| path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-x86_64-apk | |
| path: build/app/outputs/flutter-apk/app-x86_64-release.apk | |
| build-windows: | |
| name: Build Windows App | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: '3.35.5' | |
| - run: flutter pub get | |
| - run: flutter build windows | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: build/windows/x64/runner/Release | |
| build-macos: | |
| name: Build macOS App | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: '3.35.5' | |
| - run: flutter pub get | |
| - run: flutter build macos | |
| - name: Post handling | |
| run: hdiutil create -volname arabic_learning -srcfolder build/macos/Build/Products/Release/arabic_learning.app -ov -format UDZO arabic_learning.dmg | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: arabic_learning.dmg | |
| build-ios: | |
| name: Build iOS App (no sign) | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: '3.35.5' | |
| - run: flutter pub get | |
| - run: flutter build ios --no-codesign | |
| - name: Post handling | |
| run: | | |
| zip -r ios.zip build/ios/iphoneos | |
| mv ios.zip ios.ipa | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ios-build | |
| path: ios.ipa | |
| build-web: | |
| name: Build Flutter Web | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.35.5' | |
| - run: flutter pub get | |
| - run: flutter build web --release --base-href /arabic_learning/ | |
| # 上传 Web 构建结果 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| deploy-web: | |
| permissions: | |
| contents: write | |
| pages: write | |
| name: Deploy Flutter Web to GitHub Pages | |
| runs-on: ubuntu-latest | |
| needs: build-web | |
| if: github.ref == 'refs/heads/main' # 仅 main 分支部署 | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: build/web | |
| publish_branch: gh-pages | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [build-android, build-windows, build-macos, build-ios] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: android-arm-v7a-apk | |
| path: . | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: android-arm-v8a-apk | |
| path: . | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: android-x86_64-apk | |
| path: . | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: ./windows | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: ./macos | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ios-build | |
| path: ./ios | |
| - name: Prepare artifacts | |
| run: | | |
| zip -r windows.zip windows/ | |
| zip -r macos.zip macos/ | |
| zip -r ios.zip ios/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| app-armeabi-v7a-release.apk | |
| app-arm64-v8a-release.apk | |
| app-x86_64-release.apk | |
| windows.zip | |
| ios.zip | |
| macos.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |