-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(github): add workflow to deploy to docs to preview on push to t…
…agged pr Signed-off-by: Alex Marshall <[email protected]>
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Vercel Preview Docs Deployment | ||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
- opened | ||
- edited | ||
- ready_for_review | ||
|
||
jobs: | ||
Deploy-Preview: | ||
if: contains(github.event.pull_request.labels.*.name, 'documentation') || contains (github.label, 'documentation') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: step1 | ||
uses: actions/checkout@v2 | ||
- id: step2 | ||
name: Install Vercel CLI | ||
run: npm install --global vercel@canary | ||
- id: step3 | ||
name: Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | ||
- id: step4 | ||
name: Build Project Artifacts | ||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | ||
- id: step5 | ||
name: Deploy Project Artifacts to Vercel and get preview URL | ||
run: echo preview="$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} )" >> $GITHUB_ENV | ||
- id: step6 | ||
name: Comment with Preview URL | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `Docs preview: ${{ env.preview }}` | ||
}) |