readme #36
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 Flutter App | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: Build Flutter | |
| runs-on: ${{ matrix.platform == 'windows' && 'windows-latest' || 'ubuntu-latest' }} | |
| strategy: | |
| matrix: | |
| platform: [android, web, windows] | |
| steps: | |
| # Checkout the repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Set up Flutter | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: 3.24.3 | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: flutter pub get | |
| # Build APK and AAB for Android | |
| - name: Build APK and App Bundle for Android | |
| if: matrix.platform == 'android' | |
| run: | | |
| flutter build apk --release --verbose | |
| flutter build appbundle --release --verbose | |
| # Sign the AAB | |
| - name: Sign AAB | |
| if: matrix.platform == 'android' | |
| uses: r0adkll/sign-android-release@v1 | |
| with: | |
| signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
| alias: ${{ secrets.ALIAS }} | |
| keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
| keyPassword: ${{ secrets.KEY_PASSWORD }} | |
| releaseDirectory: build/app/outputs/bundle/release | |
| # Build for Web | |
| - name: Build Web | |
| if: matrix.platform == 'web' | |
| run: flutter build web --release --web-renderer html --verbose | |
| # Build for Windows | |
| - name: Build Windows | |
| if: matrix.platform == 'windows' | |
| run: flutter build windows --release --verbose | |
| # Upload Signed APK | |
| - name: Upload Signed APK | |
| if: matrix.platform == 'android' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: apk | |
| path: build/app/outputs/flutter-apk/app-release.apk | |
| # Upload Signed AAB | |
| - name: Upload Signed AAB | |
| if: matrix.platform == 'android' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-bundle | |
| path: build/app/outputs/bundle/release/app-release.aab | |
| # Upload Web Build | |
| - name: Upload Web Build | |
| if: matrix.platform == 'web' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| # Upload Windows Build | |
| - name: Upload Windows Build | |
| if: matrix.platform == 'windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: build/windows/x64/runner/Release/* | |
| # Deploy to Netlify using Netlify CLI | |
| - name: Install Netlify CLI | |
| if: matrix.platform == 'web' | |
| run: npm install -g netlify-cli | |
| - name: Netlify Deploy | |
| if: matrix.platform == 'web' | |
| run: | | |
| netlify deploy --prod --dir=build/web --site=${{ secrets.NETLIFY_SITE_ID }} --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} |