feat: 更新部署配置
parent
20a0aea7d8
commit
1fb6e6f08d
|
|
@ -1,31 +1,31 @@
|
||||||
# 工作流名称,可自定义
|
|
||||||
name: 自动部署
|
name: 自动部署
|
||||||
# 事件监听,决定什么时候触发该工作流内的任务
|
|
||||||
on:
|
on:
|
||||||
# 在master分支推动到github时触发
|
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
# 任务集合,可包含多个任务
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# 任务名称
|
deploy:
|
||||||
build:
|
|
||||||
# 运行的操作系统
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
# 步骤集合,可包含多个步骤
|
|
||||||
steps:
|
steps:
|
||||||
# 单个步骤,没有名称,直接使用一个action
|
- name: 克隆代码
|
||||||
- uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
# 单个步骤,带有名称,带有参数
|
|
||||||
- name: build and deploy
|
- name: 设置NodeJS环境
|
||||||
run: |
|
uses: actions/setup-node@v2
|
||||||
npm install
|
with:
|
||||||
npm run build
|
node-version: 18
|
||||||
cd dist
|
|
||||||
git config --global user.name "juetan"
|
- name: 安装依赖
|
||||||
git config --global user.email "810335188@qq.com"
|
run: pnpm install
|
||||||
git init
|
|
||||||
git add -A
|
- name: 构建产物
|
||||||
git commit -m "Build through github action"
|
run: pnpm run build
|
||||||
git push -f "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" master:gh-pages
|
|
||||||
|
- name: 部署到 gh-pages 分支
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./dist
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue