Update frontend module's README.md #12
This file contains 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: Deploy Flutter Web Frontend | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/publish_frontend_web.yaml' | |
- 'core/**' | |
- 'frontend/**' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Flutter packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.pub-cache | |
frontend/.dart_tool | |
core/.dart_tool | |
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pub-cache- | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.2' | |
channel: 'stable' | |
- name: Generate dotenv files | |
run: | | |
echo "BASE_URL=http://localhost:8080" > ./frontend/dotenv.dev | |
echo "BASE_URL=${{ secrets.BASE_URL }}" > ./frontend/dotenv.prod | |
- name: Get dependencies (frontend) | |
working-directory: ./frontend | |
run: flutter pub get | |
- name: Get dependencies (core) | |
working-directory: ./core | |
run: flutter pub get | |
- name: Run build_runner (core) | |
working-directory: ./core | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Run build_runner (frontend) | |
working-directory: ./frontend | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Build web app | |
working-directory: ./frontend | |
run: flutter build web --dart-define APP_ENV=production --base-href /down_the_aisle/ | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./frontend/build/web |