Skip to content
Merged
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
27 changes: 27 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Vercel Preview Deployment

on:
push:
branches-ignore:
- main

jobs:
deploy-en:
uses: ./.github/workflows/vercel-deploy.yml
with:
environment: preview
prodFlag: ''
secrets:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

deploy-zh-hans:
uses: ./.github/workflows/vercel-deploy.yml
with:
environment: preview
prodFlag: ''
secrets:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Vercel Production Deployment

on:
push:
branches:
- main

jobs:
deploy-en:
uses: ./.github/workflows/vercel-deploy.yml
with:
environment: production
prodFlag: --prod
secrets:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

deploy-zh-hans:
uses: ./.github/workflows/vercel-deploy.yml
with:
environment: production
prodFlag: --prod
secrets:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/vercel-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Vercel Deploy

on:
workflow_call:
inputs:
environment:
description: "Vercel environment (production or preview)"
required: true
type: string
prodFlag:
description: "Set to --prod for production deploys, empty for preview"
required: false
type: string
default: ""
secrets:
VERCEL_PROJECT_ID:
required: true
VERCEL_ORG_ID:
required: true
VERCEL_TOKEN:
required: true

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup pnpm
uses: pnpm/action-setup@v4.1.0

- name: Setup Node
uses: actions/setup-node@v4.4.0
with:
node-version-file: .nvmrc

- name: Install Vercel CLI
run: npm install --global vercel

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=${{ inputs.environment }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

- name: Build Project Artifacts
run: vercel build ${{ inputs.prodFlag }} --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

- name: Deploy Project Artifacts
run: vercel deploy --prebuilt ${{ inputs.prodFlag }} --archive=tgz --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ yarn-error.log*
# others
.env*.local
.env
.vercel
.vercel*
next-env.d.ts

# content
content2
content2
Loading