Skip to content

Deploy Playground to GitHub Pages #5

Deploy Playground to GitHub Pages

Deploy Playground to GitHub Pages #5

name: Deploy Playground to GitHub Pages
on:
# Run after successful release publish
workflow_run:
workflows: ['Release']
types:
- completed
branches:
- main
# Allow manual triggering
workflow_dispatch:
jobs:
deploy:
name: Deploy Playground to GitHub Pages
runs-on: ubuntu-latest
# Only run if the Release workflow was successful
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.11.1
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Cache Turbo
uses: actions/cache@v3
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Build playground
run: npm run build:playground
- name: Copy CNAME file
run: cp packages/playground/CNAME packages/playground/dist/
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: packages/playground/dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4