Skip to content

ci: add GitHub Actions workflow for PR previews #10

ci: add GitHub Actions workflow for PR previews

ci: add GitHub Actions workflow for PR previews #10

Workflow file for this run

name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
concurrency: preview-${{ github.ref }}
jobs:
deploy-preview:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
pages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
if: github.event.action != 'closed'
run: pnpm install --frozen-lockfile
- name: Build project packages
if: github.event.action != 'closed'
run: pnpm run build
- name: Build tester package
if: github.event.action != 'closed'
working-directory: packages/tester
env:
NODE_ENV: production
run: pnpm run build
- name: Verify build output
if: github.event.action != 'closed'
run: |
if [ ! -d "packages/tester/doc_build" ]; then
echo "Error: Build output directory not found!"
echo "Contents of packages/tester:"
ls -la packages/tester/
exit 1
fi
echo "Build output found:"
ls -la packages/tester/doc_build/ | head -20
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./packages/tester/doc_build/
preview-branch: gh-pages
qr-code: true
wait-for-pages-deployment: true