chore: Update web build command to fix 404 error and PWA padding issue #27
Workflow file for this run
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: Github-Pages | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: beta | |
cache: true | |
- name: Make envfile | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_API_URL: ${{ secrets.API_URL }} | |
- name: Run Tests | |
run: flutter test | |
- name: Install dependencies | |
run: flutter pub get | |
# 404.html and flutter_bootstrap.js are mannually added to the web folder to | |
# fix the 404 error on GH Pages and fix PWA Padding issue | |
- name: Build web | |
run: flutter build web --wasm --base-href /batucadapp/ --no-web-resources-cdn | |
- name: Commit changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git --work-tree build/web add --all | |
git commit -m "Deploy to GitHub Pages" | |
git push origin HEAD:gh-pages --force | |
shell: bash |