Created
March 27, 2025 22:18
-
-
Save marnixk/a5f487aa92e3cab058e702e109a53b56 to your computer and use it in GitHub Desktop.
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 & Deploy Flutter Web App | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
MAIN_FILE: ${{ github.ref == 'refs/heads/main' && 'lib/main_prod.dart' || 'lib/main.dart' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version: '3.22.0' | |
- name: Get dependencies | |
run: flutter pub get | |
working-directory: code/flutter_frontend/ | |
# - name: Test project | |
# run: flutter test | |
- name: Build release project | |
run: flutter build web --no-tree-shake-icons -t $MAIN_FILE | |
working-directory: code/flutter_frontend/ | |
- name: Upload production-ready build files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: flutter_frontend_build | |
path: ./code/flutter_frontend/build/web | |
- name: Zip build output | |
run: zip -r ../../../../build.zip . | |
working-directory: ./code/flutter_frontend/build/web | |
- name: Move zip to infrastructure | |
run: mv build.zip infrastructure/artifacts/flutter_frontend_build.zip | |
- name: Configure git | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
- name: Commit and push changes | |
run: | | |
git add infrastructure/artifacts/flutter_frontend_build.zip | |
git commit -m 'Update Flutter build artifact' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment