Upgrade to Flutter 3.27 & use pub workspace #539
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: Docs Preview Deploy | |
on: | |
pull_request_target: | |
branches: [ main ] | |
paths: | |
- '.github/workflows/docs_preview_deploy.yaml' | |
- 'docs/**' | |
- 'samples/**' | |
jobs: | |
docs: | |
name: Deploy Docs | |
runs-on: ubuntu-latest | |
environment: docs-development | |
steps: | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.AUTO_MAID_APP_ID }} | |
private_key: ${{ secrets.AUTO_MAID_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Publish samples | |
- uses: subosito/[email protected] | |
with: | |
flutter-version: 3.27.x | |
cache: true | |
- working-directory: ./samples | |
run: | | |
flutter pub get | |
dart run build_runner build --delete-conflicting-outputs | |
flutter build web | |
- uses: cloudflare/wrangler-action@v3 | |
id: publish-samples | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy ./samples/build/web --project-name=${{ vars.CLOUDFLARE_DEMO_PROJECT_NAME }} --branch=main | |
# Publish docs | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/configure-pages@v5 | |
- working-directory: ./docs | |
run: | | |
pnpm install | |
NEXT_PUBLIC_DEMO_URL=${{ steps.publish-samples.outputs.deployment-url }} pnpm run export | |
- uses: cloudflare/wrangler-action@v3 | |
id: publish-docs | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy ./docs/out --project-name=${{ vars.CLOUDFLARE_DOCS_PROJECT_NAME }} --branch=${{ github.event.pull_request.head.ref }} | |
# Create/update comment with link to preview | |
- uses: peter-evans/find-comment@v3 | |
id: find-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'auto-maid[bot]' | |
- uses: chuhlomin/[email protected] | |
id: render-markdown | |
with: | |
template: .github/deployment_preview_template.md | |
vars: | | |
sha: ${{ github.event.pull_request.head.sha }} | |
url: ${{ steps.publish-docs.outputs.deployment-url }} | |
- uses: peter-evans/create-or-update-comment@v4 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: ${{ steps.render-markdown.outputs.result }} | |
edit-mode: replace | |
# Check that all relative URLs are working. We don't check external links due to rate limiting. | |
- uses: actions/setup-go@v5 | |
- run: go install github.com/raviqqe/muffet/v2@latest | |
- run: muffet ${{ steps.publish-docs.outputs.deployment-url }} --buffer-size=8192 --exclude="(\/cdn-cgi\/)|(github.com)|(pub.dev)|(shadcn.com)" |