Update ci.yaml to use latest version of pnpm for Vercel commands

This commit is contained in:
严浩
2024-09-27 09:33:06 +08:00
parent e50a16a583
commit b4a66d4274
2 changed files with 7 additions and 10 deletions

View File

@ -3,9 +3,6 @@ name: CI
on: on:
push: push:
branches:
- main
pull_request:
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
group: 'ci' group: 'ci'
@ -26,7 +23,7 @@ jobs:
- name: 安装 pnpm - name: 安装 pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
with: with:
version: 9 version: latest
run_install: false run_install: false
- name: 安装 Node.js - name: 安装 Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -45,16 +42,16 @@ jobs:
# https://github.com/vercel/examples/tree/main/ci-cd/github-actions # https://github.com/vercel/examples/tree/main/ci-cd/github-actions
# cname-cn.vercel.com cname-china.vercel-dns.com # cname-cn.vercel.com cname-china.vercel-dns.com
- name: Pull Vercel Environment Information - name: 拉取 Vercel 环境信息
run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} run: pnpm exec vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts - name: 构建项目
run: pnpm exec vercel build --target=production --token=${{ secrets.VERCEL_TOKEN }} run: pnpm exec vercel build --target=production --token=${{ secrets.VERCEL_TOKEN }}
env: env:
VITE_BUILD_COMMIT: ${{ github.sha }} VITE_BUILD_COMMIT: ${{ github.sha }}
- name: Deploy Project Artifacts to Vercel - name: 部署到 Vercel
run: pnpm exec vercel deploy --prebuilt --target=production --token=${{ secrets.VERCEL_TOKEN }} run: pnpm exec vercel deploy --prebuilt --target=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Surge - name: 部署到 Surge
id: surge_deploy id: surge_deploy
# pnpm exec surge token / pnpx surge token # pnpm exec surge token / pnpx surge token
# https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550 # https://github.com/Tencent/tdesign-vue-next/pull/1604#issuecomment-1236244550
@ -62,7 +59,7 @@ jobs:
run: | run: |
repository=${{github.repository}} repository=${{github.repository}}
project_name=${repository#*/} project_name=${repository#*/}
export DEPLOY_DOMAIN=https://preview-pr${{ github.run_number }}-vue-ts-example.surge.sh export DEPLOY_DOMAIN=https://preview-pr${{ github.run_number }}-$project_name.surge.sh
cp dist/index.html dist/200.html cp dist/index.html dist/200.html
pnpm exec surge --project ./dist --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }} pnpm exec surge --project ./dist --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
echo the preview URL is $DEPLOY_DOMAIN echo the preview URL is $DEPLOY_DOMAIN

2
.npmrc
View File

@ -3,7 +3,7 @@ registry=https://registry.npmjs.org/
registry=https://r-npm.oo1.dev registry=https://r-npm.oo1.dev
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir # https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
#use-node-version=20.17.0 use-node-version=20.17.0
node-mirror:release=https://npmmirror.com/mirrors/node/ node-mirror:release=https://npmmirror.com/mirrors/node/
node-mirror:rc=https://npmmirror.com/mirrors/node-rc/ node-mirror:rc=https://npmmirror.com/mirrors/node-rc/
node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/ node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/