Skip to content

version: 8.1.2-beta.2 #51

version: 8.1.2-beta.2

version: 8.1.2-beta.2 #51

Workflow file for this run

# 整个流程的名字
name: Release
# 触发时机,在 tag 被 push 操作触发
on:
push:
tags:
- "v*"
# 任务,定义个changelog 的任务
jobs:
changelog:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# # 设置 pnpm
# - name: Setup PNPM
# uses: pnpm/action-setup@v2
# with:
# version: 8
# 设置 Node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
registry-url: https://registry.npmjs.org
# 安装依赖
- name: Install dependencies
run: npm install
# 获取 tag 的版本类型(仅支持 正式版和beta版)
- name: Determine release tag
id: determine_tag
run: |
TAG=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\/\(.*\)/\1/')
if [[ "$TAG" =~ -beta ]]; then
echo "::set-output name=tag::beta"
elif [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::set-output name=tag::latest"
else
echo "Unsupported version detected. Terminating."
exit 1
fi
# # 打包
# - name: Build Packages
# run: pnpm run build
# 发布npm 发布前执行了prepublishOnly
- name: Publish npm
run: npm publish --tag ${{ steps.determine_tag.outputs.tag }}
env:
# 这里需要几个 Token 变量
# NPM_TOKEN 需要在 npm 网站生成
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}