Update static.yml #6
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: Build and Deploy Flutter Web App | ||
on: | ||
# Trigger on pushes to the master branch | ||
push: | ||
branches: [ master ] | ||
# Allow manual triggering | ||
workflow_dispatch: | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: 'stable' | ||
- name: Get dependencies | ||
run: flutter pub get | ||
- name: Enable web support | ||
run: flutter config --enable-web | ||
- name: Build web app | ||
run: flutter build web -t web | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: web-build | ||
path: ./web-demo/build/web | ||
# Assuming you want to deploy to GitHub Pages (replace with your deployment step if needed) | ||
deploy-to-github-pages (optional): | ||
Check failure on line 38 in .github/workflows/static.yml GitHub Actions / Build and Deploy Flutter Web AppInvalid workflow file
|
||
runs-on: ubuntu-latest | ||
needs: build-and-deploy | ||
if: github.event.type == 'push' && github.base_branch == 'master' # Deploy only on push to master branch | ||
environment: | ||
name: production | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: web-build | ||
- name: Deploy to GitHub Pages (requires GH Pages token) | ||
uses: actions/deploy-pages@v4 | ||
with: | ||
token: ${{ secrets.MY_TOKEN }} | ||
source: ./web-demo/build/web # Path to your built web app | ||
branch: gh-pages # Target branch for deployment (replace if needed) | ||
fail_on_errors: true # Fail workflow on deployment errors |