feat: Update Dart workflow to use Flutter for dependency installation #1
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: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-android: | |
| name: Build Android APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.0' | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Decode keystore | |
| if: env.KEYSTORE_BASE64 != '' | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} | |
| run: | | |
| echo "$KEYSTORE_BASE64" | base64 -d > android/app/upload-keystore.jks | |
| echo "$KEY_PROPERTIES" > android/key.properties | |
| - name: Build APK | |
| run: flutter build apk --release | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-apk | |
| path: build/app/outputs/flutter-apk/app-release.apk | |
| build-windows: | |
| name: Build Windows Installer | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.0' | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build Windows | |
| run: flutter build windows --release | |
| - name: Create MSIX installer | |
| run: | | |
| dart pub global activate msix | |
| dart pub global run msix:create --build-windows false | |
| continue-on-error: true | |
| - name: Upload Windows build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: | | |
| build/windows/x64/runner/Release/ | |
| build/windows/x64/runner/Release/*.msix | |
| build-macos: | |
| name: Build macOS | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.0' | |
| channel: stable | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build macOS | |
| run: flutter build macos --release | |
| - name: Create DMG | |
| run: | | |
| APP_PATH="build/macos/Build/Products/Release/hushnet_frontend.app" | |
| DMG_PATH="build/macos/HushNet.dmg" | |
| hdiutil create -volname "HushNet" -srcfolder "$APP_PATH" -ov -format UDZO "$DMG_PATH" | |
| - name: Upload macOS DMG | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-dmg | |
| path: build/macos/HushNet.dmg | |
| release: | |
| name: Create GitHub Release | |
| needs: [build-android, build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mv artifacts/android-apk/app-release.apk artifacts/HushNet-android.apk | |
| mv artifacts/macos-dmg/HushNet.dmg artifacts/HushNet-macos.dmg | |
| cd artifacts/windows-installer && zip -r ../HushNet-windows.zip . && cd ../.. | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artifacts/HushNet-android.apk | |
| artifacts/HushNet-macos.dmg | |
| artifacts/HushNet-windows.zip |