Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(vercel): Use GitHub action to deploy docs preview #374

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/vercel-preview.yaml
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 }}`
})
22 changes: 22 additions & 0 deletions .github/workflows/vercel-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Vercel Production Docs Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches:
- main
jobs:
Deploy-Production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Vercel CLI
run: npm install --global vercel@canary
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ repos:
rev: v1.29.0
hooks:
- id: yamllint
exclude: ".*/templates/.*"
exclude: "^(.github/workflows/*.*)$"
- repo: https://github.com/IamTheFij/docker-pre-commit
rev: v2.1.1
hooks:
Expand Down
3 changes: 3 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"buildCommand": "mkdocs build",
"github": {
"silent": true
},
"git": {
"deploymentEnabled": false
}
}
Loading