Flutter Build and Release #25
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: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| FLUTTER_VERSION: "3.41.6" | |
| WORKING_DIR: flutter_app | |
| jobs: | |
| # ── Android (APK) ────────────────────────────────────────────── | |
| build-android: | |
| name: Android | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: zulu | |
| java-version: "17" | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies & generate code | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| flutter pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Build APK | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: flutter build apk --release | |
| - name: Rename artifact | |
| run: | | |
| cp ${{ env.WORKING_DIR }}/build/app/outputs/flutter-apk/app-release.apk \ | |
| DungeonMasterTool-Android.apk | |
| - name: Upload to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: DungeonMasterTool-Android.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DungeonMasterTool-Android | |
| path: DungeonMasterTool-Android.apk | |
| # ── Windows ──────────────────────────────────────────────────── | |
| build-windows: | |
| name: Windows | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies & generate code | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| flutter pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Build Windows | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: flutter build windows --release | |
| - name: Archive | |
| shell: pwsh | |
| run: | | |
| Compress-Archive ` | |
| -Path "${{ env.WORKING_DIR }}\build\windows\x64\runner\Release\*" ` | |
| -DestinationPath DungeonMasterTool-Windows.zip | |
| - name: Upload to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: DungeonMasterTool-Windows.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DungeonMasterTool-Windows | |
| path: DungeonMasterTool-Windows.zip | |
| # ── Linux ────────────────────────────────────────────────────── | |
| build-linux: | |
| name: Linux | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| cache: true | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| clang cmake ninja-build pkg-config \ | |
| libgtk-3-dev liblzma-dev libstdc++-12-dev \ | |
| libasound2-dev | |
| - name: Install dependencies & generate code | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| flutter pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Build Linux | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: flutter build linux --release | |
| - name: Archive | |
| run: | | |
| cd ${{ env.WORKING_DIR }}/build/linux/x64/release | |
| zip -r "$GITHUB_WORKSPACE/DungeonMasterTool-Linux.zip" bundle | |
| - name: Upload to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: DungeonMasterTool-Linux.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DungeonMasterTool-Linux | |
| path: DungeonMasterTool-Linux.zip | |
| # ── macOS ────────────────────────────────────────────────────── | |
| build-macos: | |
| name: macOS | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies & generate code | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: | | |
| flutter pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Build macOS | |
| working-directory: ${{ env.WORKING_DIR }} | |
| run: flutter build macos --release | |
| - name: Archive | |
| run: | | |
| cd ${{ env.WORKING_DIR }}/build/macos/Build/Products/Release | |
| zip -r -y "$GITHUB_WORKSPACE/DungeonMasterTool-MacOS.zip" "dungeon_master_tool.app" | |
| - name: Upload to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: DungeonMasterTool-MacOS.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DungeonMasterTool-MacOS | |
| path: DungeonMasterTool-MacOS.zip |