Skip to content

ci(deploy): 更新 GitHub Actions 工作流 #29

ci(deploy): 更新 GitHub Actions 工作流

ci(deploy): 更新 GitHub Actions 工作流 #29

Workflow file for this run

name: Vite Vue Deploy
permissions:
contents: write
on:
push:
# master 分支有 push 时触发
branches: [master]
jobs:
deploy:
# 指定虚拟机环境
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- name: Checkout 🛎️
# 拉取 GitHub 仓库代码
uses: actions/checkout@v4
- name: Install Node.js
# 设定 Node.js 环境
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.com/
- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v3
# 安装依赖
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build 🔧
# 打包
run: pnpm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
# 部署打包目录
folder: dist
# 是否清理旧文件
clean: true
# 密钥名
token: ${{ secrets.VITE_VUE_DEPLOY }}
# 分支
branch: gh-pages