feat: docs deployment (#3) #5
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
name: "Deploy Clutch docs to vercel" | |
on: | |
push: | |
paths: | |
- docs/** | |
- .github/workflows/deploy-docs.yml | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Vercel CLI | |
working-directory: docs | |
run: pnpm install --global vercel@latest | |
- name: Vercel Pull | |
working-directory: docs | |
run: vercel pull --token ${{ secrets.VERCEL_CI_TOKEN }} --scope clutch-creator --yes | |
- name: Build | |
working-directory: docs | |
run: vercel build --token ${{ secrets.VERCEL_CI_TOKEN }} --prod | |
- name: Deploy | |
working-directory: docs | |
run: vercel deploy --prod --prebuilt --token ${{ secrets.VERCEL_CI_TOKEN }} --scope clutch-creator --yes | |
- name: Update deployment domain | |
working-directory: docs | |
shell: bash | |
run: | | |
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" --location 'https://api.vercel.com/v9/projects/docs/domains/docs.clutch.show?teamId=clutch-creator' --header 'Authorization: Bearer ${{ secrets.VERCEL_CI_TOKEN }}') | |
if [ $STATUS_CODE -eq 200 ]; then | |
echo "Domain already exists" | |
exit 0 | |
fi | |
vercel domains add 'docs.clutch.io' --token ${{ secrets.VERCEL_CI_TOKEN }} --scope clutch-creator |