Skip to content

ci: 🎡 自动修改版本 #75

ci: 🎡 自动修改版本

ci: 🎡 自动修改版本 #75

Workflow file for this run

# 1. 为工作流定义名字
name: 「GitHub Pages」Build & Deploy
# 2. 触发条件修改为: 当 main 或 master 分支, 有 push 的时候, 执行任务
on:
push:
branches:
- master
- admin
# 3. 创建工作流
jobs:
build: # 工作流名称
runs-on: ubuntu-latest # 依赖环境
steps: # 工作流步骤
# step 1. 获取源码, 拉取仓库代码
- name: Chekcout 🛎️ # 步骤名
uses: actions/checkout@master # 使用插件 => https://github.com/actions/checkout
- name: Install pnpm
uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
- name: Install dependencies
shell: bash
run: pnpm install
# step 3. 安装依赖并打包
- name: Install and Build 🔧
run: |
pnpm config set registry https://registry.npmmirror.com
pnpm build:admin
# step 4. 项目部署, 将打包后的产物合并到指定的分支上
- name: Deploy 🚀 # 步骤名
uses: JamesIves/[email protected] # 使用插件 => https://github.com/JamesIves/github-pages-deploy-action
with:
BRANCH: gh-pages # 部署分支
FOLDER: gbeata-dist # 打包, 静态资源输出的目录
- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: pnpm change:ver
publish: pnpm change:pub
commit: "ci: release"
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
- name: Read Package.json
uses: tyankatsu0105/read-package-version-actions@v1
id: packagejson
- name: Debug Package Version
run: echo "Package version ${{ steps.packagejson.outputs.version }}"
- name: Create Release for Tag
uses: actions/create-release@v1
id: release-tag
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
with:
tag_name: ${{ steps.packagejson.outputs.version }}
name: ${{ steps.packagejson.outputs.version }}
body: ${{ steps.packagejson.outputs.content }}
draft: false
prerelease: false