Skip to content

Deploy preview

Deploy preview #25

Workflow file for this run

name: Test deployment
on:
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm install --frozen-lockfile
- name: Test build website
run: |
npm run build
npm run build:docs
test-deploy-24:
name: Deploy 24
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
strategy:
matrix:
node-version: [24]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm install --frozen-lockfile
- name: Build docs
run: |
npm run build
npm run build:docs
- name: Build preview docs
run: |
cd build/docs/gatsby
npm install
# Backup original config
cp gatsby-config.js gatsby-config-original.js
# Modify config for preview
sed -i 's|pathPrefix: "/execution-apis"|pathPrefix: "/execution-apis/preview/PR${{ github.event.number }}"|g' gatsby-config.js
# Build with modified config
npx gatsby build --prefix-paths
# Restore original config
cp gatsby-config-original.js gatsby-config.js
# Move preview build to separate directory
mv public public-preview
# Rebuild main site
npx gatsby build --prefix-paths
- name: Cache docs build output
uses: actions/cache@v4
with:
path: |
build/docs/gatsby/public
build/docs/gatsby/public-preview
key: docs-build-${{ github.sha }}
restore-keys: |
docs-build-
deploy-preview:
name: Deploy Preview
needs: test-deploy-24
if: github.event_name == 'pull_request'
uses: ./.github/workflows/deploy-preview.yaml
with:
pr_number: ${{ github.event.number }}
commit_sha: ${{ github.sha }}
action: ${{ github.event.action == 'closed' && 'delete' || 'create' }}
secrets:
TOKEN: ${{ secrets.GITHUB_TOKEN }}