11name : Preview
22on :
33 pull_request :
4+ push :
5+ branches :
6+ - main
47env :
58 NPM_TOKEN_READONLY : ${{ secrets.NPM_TOKEN_READONLY }}
69jobs :
2629 run : bun install --frozen-lockfile
2730 env :
2831 PUPPETEER_SKIP_DOWNLOAD : 1
32+ - name : Sets env vars for production
33+ if : github.ref == 'refs/heads/main'
34+ run : |
35+ echo "SENTRY_ENVIRONMENT=production" >> $GITHUB_ENV
36+ echo "GITBOOK_ASSETS_PREFIX=https://static.gitbook.com" >> $GITHUB_ENV
2937 - name : Sets env vars for preview
38+ if : github.ref != 'refs/heads/main'
3039 run : |
3140 echo "SENTRY_ENVIRONMENT=preview" >> $GITHUB_ENV
3241 - name : Build Next.js with next-on-pages
@@ -46,13 +55,13 @@ jobs:
4655 accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
4756 workingDirectory : ./
4857 wranglerVersion : ' 3.112.0'
49- command : pages deploy ./packages/gitbook/.vercel/output/static --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ format('pr{0}', github.event.pull_request.number) }}
58+ command : pages deploy ./packages/gitbook/.vercel/output/static --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=${{ github.ref == 'refs/heads/main' && 'main' || format('pr{0}', github.event.pull_request.number) }}
5059 - name : Outputs
5160 run : |
5261 echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
5362 echo "Alias URL: ${{ steps.deploy.outputs.deployment-alias-url }}"
5463 deploy-v2-vercel :
55- name : Deploy v2 to Vercel
64+ name : Deploy v2 to Vercel (preview)
5665 runs-on : ubuntu-latest
5766 permissions :
5867 contents : read
7584 vercel-project : ${{ secrets.VERCEL_PROJECT_ID }}
7685 vercel-token : ${{ secrets.VERCEL_TOKEN }}
7786 deploy-v2-cloudflare :
78- name : Deploy v2 to Cloudflare Worker
87+ name : Deploy v2 to Cloudflare Worker (preview)
7988 runs-on : ubuntu-latest
8089 permissions :
8190 contents : read
@@ -107,7 +116,7 @@ jobs:
107116 echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
108117 comment-deployments :
109118 runs-on : ubuntu-latest
110- name : Comment Deployments
119+ name : Comment Deployments (preview)
111120 if : always()
112121 needs :
113122 - deploy-v1-cloudflare
0 commit comments