-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 2.28 KB
/
Copy pathchangeset-release.yml
File metadata and controls
61 lines (53 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: changeset-release
# Changesets: 在 main 上开/更新 Version Packages PR;
# 合并该 PR(版本已 bump)后自动 changeset publish。
# 当前仓库处于 pre mode (beta):publish 仅推 npm dist-tag beta。
# 未达 release 门槛前禁止 changeset pre exit。
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: changeset-release
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
# fetch-depth:0:tag-packages 需 HEAD~1 做版本 diff;浅克隆时 resolvePackagesNeedingTags 才回退 from-existing
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v5
with:
node-version-file: .node-version
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci --no-audit --no-fund
- name: build publishable workspaces
# DRY:包清单与拓扑权威在 tools/lib/npm-publish-packages.mjs,勿在此再抄 workspace 列表
run: node tools/build-publishable.mjs
# Version PR 需要「创建 PR」权限。仅用 GITHUB_TOKEN 且仓库关闭
# Settings→Actions→General→「Allow GitHub Actions to create and approve pull requests」时,
# changesets/action 会 HttpError(分支已推送但 PR 未创建)。
# 优先 PAT:SFMC_GITHUB_TOKEN(权威名);兼容旧名 CHANGESETS_GITHUB_TOKEN;再回退 GITHUB_TOKEN。
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: npm run version-packages
# CI 不跑交互 changeset/version;只 publish + tag + gh release
# tag-packages 默认 HEAD~1 版本 diff(空状态文件亦信任,禁止扫全仓 tag)
publish: npm run ci-release-packages
title: "chore(release): version packages"
commit: "chore(release): version packages"
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.SFMC_GITHUB_TOKEN || secrets.CHANGESETS_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}