Skip to content

Update pubspec.yaml #89

Update pubspec.yaml

Update pubspec.yaml #89

# Builds and deploys example web apps for each of the packages to GitHub Pages
name: Deploy examples to GitHub Pages
on:
push:
branches:
- main
paths:
- 'packages/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Determine which packages have example apps
find-example-apps:
runs-on: ubuntu-latest
outputs:
example-apps: ${{ steps.find-example-apps.outputs.example-apps }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- run: man ls
- name: Find example apps
id: find-example-apps
# Outputs a JSON list of packages with example apps, e.g. ["dynamic_color", "google_fonts"]
run: |
echo "::set-output name=example-apps::$(ls -d */example | xargs dirname | jq -R -s -c 'split("\n")[:-1]')"
working-directory: packages
# Build example web apps job
build:
needs: find-example-apps
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
package: ${{ fromJson(needs.find-example-apps.outputs.example-apps) }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
channel: 'stable'
- name: Build Flutter web app
run: flutter build web -v --release --output /tmp/${{ matrix.package }} --base-href /${{ github.event.repository.name }}/${{ matrix.package }}/
working-directory: packages/${{ matrix.package }}/example
- name: Upload web build temporarily
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: ${{ matrix.package }}
path: /tmp/${{ matrix.package }}
retention-days: 1
# Upload pages artifact to pages job
upload-to-pages:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all web builds
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: Upload pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: '.'
# Deploy job
deploy-pages:
needs: upload-to-pages
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5