Skip to content

Commit c145e60

Browse files
committed
feat: update-docs-ci use vercel-deploy
1 parent 309c279 commit c145e60

File tree

4 files changed

+76
-26
lines changed

4 files changed

+76
-26
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Vercel Build"
2+
description: "Build project artifacts using Vercel CLI for deployment."
3+
inputs:
4+
environment:
5+
description: "Vercel environment (production or preview)"
6+
required: true
7+
prodFlag:
8+
description: "Set to --prod for production deploys, empty for preview"
9+
required: false
10+
default: ""
11+
vercel_project_id:
12+
required: true
13+
vercel_org_id:
14+
required: true
15+
vercel_token:
16+
required: true
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Pull Vercel Environment Information
21+
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
22+
env:
23+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
24+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
25+
shell: bash
26+
- name: Echo Vercel Environment File
27+
run: |
28+
ls -l .vercel/.env*
29+
for f in .vercel/.env*; do
30+
echo "\n----- $f -----"
31+
cat "$f"
32+
done
33+
shell: bash
34+
- name: Build Project Artifacts
35+
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
36+
env:
37+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
38+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
39+
shell: bash

.github/actions/vercel-deploy/action.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,14 @@ outputs:
2424
runs:
2525
using: "composite"
2626
steps:
27-
- name: Pull Vercel Environment Information
28-
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
29-
env:
30-
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
31-
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
32-
shell: bash
33-
- name: Echo Vercel Environment File
34-
run: |
35-
ls -l .vercel/.env*
36-
for f in .vercel/.env*; do
37-
echo "\n----- $f -----"
38-
cat "$f"
39-
done
40-
shell: bash
41-
- name: Build Project Artifacts
42-
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
43-
env:
44-
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
45-
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
46-
shell: bash
27+
- name: Build with Vercel
28+
uses: ./.github/actions/vercel-build
29+
with:
30+
environment: ${{ inputs.environment }}
31+
prodFlag: ${{ inputs.prodFlag }}
32+
vercel_project_id: ${{ inputs.vercel_project_id }}
33+
vercel_org_id: ${{ inputs.vercel_org_id }}
34+
vercel_token: ${{ inputs.vercel_token }}
4735
- name: Deploy Project Artifacts
4836
id: vercel_deploy
4937
run: |

.github/workflows/prerelease.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
name: Prerelease
22

33
on:
4-
workflow_dispatch:
54
pull_request:
65
types:
76
- opened
87
- labeled
98
- synchronize
9+
branches-ignore:
10+
- docs/update-translations
11+
- docs/sync-nextjs-documentation
1012

1113
permissions:
1214
pull-requests: write
1315
issues: write
1416

1517
jobs:
1618
deploy:
19+
if: |
20+
github.event_name == 'pull_request' &&
21+
contains(github.event.pull_request.labels.*.name, 'prerelease')
1722
runs-on: ubuntu-latest
1823
strategy:
1924
matrix:
@@ -94,7 +99,6 @@ jobs:
9499
needs: deploy
95100
name: Comment Vercel Previews
96101
runs-on: ubuntu-latest
97-
if: always()
98102
steps:
99103
- name: Checkout repo
100104
uses: actions/checkout@v3

.github/workflows/update-docs-ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,34 @@ on:
77
- docs/sync-nextjs-documentation
88

99
jobs:
10-
translate:
10+
deploy-and-update-index:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
- locale: en
16+
secret_project_id: VERCEL_PROJECT_EN_ID
17+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_EN
18+
- locale: zh-hans
19+
secret_project_id: VERCEL_PROJECT_ZH_HANS_ID
20+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANS
21+
- locale: zh-hant
22+
secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
23+
orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANT
24+
name: Build ${{ matrix.locale }}
1225
steps:
13-
# Checkout the repository first to access local actions
1426
- name: Checkout code
1527
uses: actions/checkout@v3
1628
with:
1729
fetch-depth: 1
1830
- name: Setup Tools
19-
# After pnpm install, apps/docs will execute postinstall: fumadocs-mdx
20-
# Which will generated MDX types (check if the docs frontmatter is correct)
2131
uses: ./.github/actions/setup
32+
- name: Build ${{ matrix.locale }}
33+
id: deploy
34+
uses: ./.github/actions/vercel-build
35+
with:
36+
environment: production
37+
prodFlag: --prod
38+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
39+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
40+
vercel_token: ${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)