-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): allow preview of website changes (#12966)
- Loading branch information
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters