Skip to content

Commit c8aa8bd

Browse files
committed
Run visual testing on main as well
1 parent 831e68f commit c8aa8bd

File tree

3 files changed

+17
-52
lines changed

3 files changed

+17
-52
lines changed

.github/workflows/deploy-preview.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Preview
22
on:
33
pull_request:
4+
push:
5+
branches:
6+
- main
47
env:
58
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
69
jobs:
@@ -26,7 +29,13 @@ jobs:
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
@@ -75,7 +84,7 @@ jobs:
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

.github/workflows/deploy-production.yaml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,8 @@ on:
44
branches:
55
- main
66
jobs:
7-
deploy-v1-cloudflare:
8-
name: Deploy v1 to Cloudflare Pages
9-
runs-on: ubuntu-latest
10-
permissions:
11-
contents: read
12-
deployments: write
13-
issues: write
14-
pull-requests: write
15-
checks: write
16-
statuses: write
17-
outputs:
18-
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v4
22-
- name: Setup Bun
23-
uses: ./.github/composite/setup-bun
24-
- name: Install dependencies
25-
run: bun install --frozen-lockfile
26-
env:
27-
PUPPETEER_SKIP_DOWNLOAD: 1
28-
- name: Sets env vars for production
29-
run: |
30-
echo "SENTRY_ENVIRONMENT=production" >> $GITHUB_ENV
31-
echo "GITBOOK_ASSETS_PREFIX=https://static.gitbook.com" >> $GITHUB_ENV
32-
- name: Build Next.js with next-on-pages
33-
run: bun run turbo gitbook#build:cloudflare
34-
env:
35-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
36-
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ secrets.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY }}
37-
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
38-
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
39-
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
40-
SENTRY_RELEASE: ${{ github.sha }}
41-
- id: deploy
42-
name: Deploy to Cloudflare
43-
uses: cloudflare/[email protected]
44-
with:
45-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
46-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
47-
workingDirectory: ./
48-
wranglerVersion: '3.82.0'
49-
command: pages deploy ./packages/gitbook/.vercel/output/static --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --branch=main
50-
517
deploy-v2-vercel:
52-
name: Deploy v2 to Vercel
8+
name: Deploy v2 to Vercel (production)
539
runs-on: ubuntu-latest
5410
permissions:
5511
contents: read
@@ -72,7 +28,7 @@ jobs:
7228
vercel-project: ${{ secrets.VERCEL_PROJECT_ID }}
7329
vercel-token: ${{ secrets.VERCEL_TOKEN }}
7430
deploy-v2-cloudflare:
75-
name: Deploy v2 to Cloudflare Worker
31+
name: Deploy v2 to Cloudflare Worker (production)
7632
runs-on: ubuntu-latest
7733
permissions:
7834
contents: read

.github/workflows/deploy-staging.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- main
66
jobs:
77
deploy-v2-vercel:
8-
name: Deploy v2 to Vercel
8+
name: Deploy v2 to Vercel (staging)
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: read
@@ -28,7 +28,7 @@ jobs:
2828
vercel-project: ${{ secrets.VERCEL_PROJECT_ID }}
2929
vercel-token: ${{ secrets.VERCEL_TOKEN }}
3030
deploy-v2-cloudflare:
31-
name: Deploy v2 to Cloudflare Worker
31+
name: Deploy v2 to Cloudflare Worker (staging)
3232
runs-on: ubuntu-latest
3333
permissions:
3434
contents: read

0 commit comments

Comments
 (0)