You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
name: Deploy Flutter Web to GitHub Pages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
|
|
- name: Flutter version
|
|
run: flutter --version
|
|
|
|
- name: Enable web and get packages
|
|
run: |
|
|
flutter config --enable-web
|
|
flutter pub get
|
|
|
|
- name: Build Flutter web (release)
|
|
env:
|
|
REPO_NAME: ${{ github.event.repository.name }}
|
|
run: |
|
|
# Use canvaskit for better desktop rendering; adjust if needed
|
|
flutter build web \
|
|
--release \
|
|
--web-renderer canvaskit \
|
|
--base-href "/${REPO_NAME}/"
|
|
|
|
- name: Deploy to GitHub Pages
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./build/web
|
|
# Keep history small
|
|
force_orphan: true
|
|
|