Skip to content

Add url to Preview deployment #24

Add url to Preview deployment

Add url to Preview deployment #24

Workflow file for this run

name: Deploy example page
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
- name: Install Dependencies
run: pnpm install --ignore-scripts
- name: Build
run: pnpm build:packages
- name: Build site
run: pnpm build:sandbox
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: examples/sandbox/dist
Deploy:
needs: Build
name: Deploy to Production env
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: Production
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Deploy_Preview:
needs: Build
name: Deploy to Preview env
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: Preview
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4