Skip to content

Deploy example site to Pages #2

Deploy example site to Pages

Deploy example site to Pages #2

name: Deploy example site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
# Runs on pull requests targeting the default branch
pull_request:
branches: [$default-branch]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure GitHub Pages
id: pages
uses: actions/[email protected]
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
version: 3.13.0
channel: 'stable'
- name: Setup project and run test
run: |
flutter pub get
flutter test
- name: Setup example and build
working-directory: ./example
run: |
flutter pub get
flutter build web --release --base-href="/flutter_choice/"
- name: Upload production-ready build example
uses: actions/upload-artifact@v2
with:
name: production-example
path: ./example/build/web
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1