Skip to content

Commit

Permalink
feat(website): allow preview of website changes (#12966)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jan 18, 2023
1 parent b0c8b60 commit 5304606
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Website
name: Website Build

on:
push:
Expand Down Expand Up @@ -50,3 +50,4 @@ jobs:

- name: Build Website
run: pnpm -F website build

57 changes: 57 additions & 0 deletions .github/workflows/website_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Website Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_WEBSITE_PROJECT_ID }}
on:
pull_request:
types:
- opened
- reopened
- edited
paths:
- "packages/website/**"
jobs:
vercel-preview:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Set up protocol
uses: ./.github/actions/set-up-protocol

- name: Install Vercel CLI
run: pnpm install --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > url.txt

- name: Get Preview URL
id: get-url
run: echo ::set-output name=url::$(cat url.txt)

- name: Test output
run: echo ${{ steps.get-url.outputs.url }}

- name: Create Preview Comment
uses: actions/github-script@v5
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '☂️☂️☂️ Preview the changes at: ${{ steps.get-url.outputs.url }}'
})
2 changes: 1 addition & 1 deletion .github/workflows/whitepaper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
paths:
- "packages/whitepaper/**"
jobs:
build_latex:
build-latex:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
Expand Down

0 comments on commit 5304606

Please sign in to comment.