Skip to content

chore: ci update

chore: ci update #13

Workflow file for this run

## CD交付流水线
## - 部署到Github Pages
## - 部署到Vercel托管平台
## - 发布新的Github Release
## 参考资料:https://v2.vuepress.vuejs.org/zh/guide/deployment.html#github-pages
name: CD
on:
push:
branches:
- fix/vercel-CD
workflow_dispatch:
## vercel 环境变量
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
install-init:
name: "依赖安装初始化"
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: PNPM Install
uses: pnpm/action-setup@v2
with:
version: 7
run_install: |
args: [--frozen-lockfile, --registry=https://registry.npmmirror.com]
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 18.18.0
# ## 淘宝镜像加速
# registry-url: 'https://registry.npmmirror.com'
# cache: 'pnpm'
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
## 部署到vercel平台
deploy-vercel:
name: "部署到Vercel平台"
needs:
- install-init
runs-on: macos-latest
if: github.repository == '142vip/408CSFamily'
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
persist-credentials: false
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
## 注意: 这里的操作时间vercel平台配置的命令拉取下来,执行
- name: Pull Vercel Environment Information
run: npm i vercel -g && vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
## 执行vercel平台配置的命令
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
## dist文件同步到vercel平台
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}