Skip to content

Preview

Preview #15

Workflow file for this run

name: Preview
on:
workflow_run:
workflows: ["Code check"]
types:
- completed
workflow_dispatch:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
preview:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
environment:
name: Preview
url: ${{ steps.deploy.outputs.url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: "Install Node.js"
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install
- run: pnpm vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- run: pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }}
- id: deploy
run: echo "url=$(pnpm vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT