Skip to content

Commit de3913c

Browse files
committed
ci: new auto new release
1 parent 4737b8b commit de3913c

5 files changed

Lines changed: 118 additions & 148 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ PR 在维护者审核通过后会合并,谢谢!
3232
3. 涉及UI/交互变动需要有截图或 GIF。
3333
-->
3434

35-
### 📝 更新日志
35+
- [ ] 本条 PR 不需要纳入 Changelog
3636

37+
#### @tdesign/web-components
3738
<!--
38-
从用户角度描述具体变化,以及可能的 breaking change 和其他风险。
39-
-->
40-
41-
- fix(组件名称): 处理问题或特性描述 ...
39+
- feat(组件名称): 处理问题或特性描述
40+
-->
4241

43-
- [ ] 本条 PR 不需要纳入 Changelog
42+
#### @tdesign/web-components-chat
43+
<!--
44+
- feat(组件名称): 处理问题或特性描述
45+
-->
4446

4547
### ☑️ 请求合并前的自查清单
4648

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: auto-changelog-callback
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- auto-changelog
7+
types:
8+
- completed
9+
10+
jobs:
11+
commit-changelog:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request_review' }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Download pr id
16+
uses: dawidd6/action-download-artifact@v21
17+
with:
18+
workflow: ${{ github.event.workflow_run.workflow_id }}
19+
run_id: ${{ github.event.workflow_run.id }}
20+
name: pr-id
21+
22+
- name: Output pr id
23+
id: pr
24+
run: echo "id=$(cat pr-id.txt)" >> $GITHUB_OUTPUT
25+
26+
- name: auto-changelog
27+
uses: TDesignOteam/flow-pilot-action@develop
28+
with:
29+
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
30+
packages: |
31+
@tdesign/web-components
32+
@tdesign/web-components-chat
33+
pr_number: ${{ steps.pr.outputs.id }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: auto-changelog
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
pull_request_review:
8+
types: [submitted]
9+
10+
issue_comment:
11+
types: [created, edited]
12+
13+
jobs:
14+
changelog:
15+
if: github.event.review.state == 'approved'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: echo ${{ github.event.pull_request.number }} > pr-id.txt
19+
20+
- uses: actions/upload-artifact@v7
21+
with:
22+
name: pr-id
23+
path: pr-id.txt
24+
retention-days: 5
25+
26+
comment-release-changelog:
27+
if: github.event.pull_request && startsWith(github.head_ref, 'release/')
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: auto-changelog
31+
uses: TDesignOteam/flow-pilot-action@develop
32+
with:
33+
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
34+
packages: |
35+
@tdesign/web-components
36+
@tdesign/web-components-chat
37+
38+
commit-changelog:
39+
if: github.event.issue.pull_request
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: auto-changelog
43+
uses: TDesignOteam/flow-pilot-action@develop
44+
with:
45+
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
46+
packages: |
47+
@tdesign/web-components
48+
@tdesign/web-components-chat

.github/workflows/auto-release.yml

Lines changed: 29 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,39 @@
1-
name: Auto Release
1+
name: auto-release
22

33
on:
44
pull_request:
5-
branches: [develop]
6-
types: [opened, synchronize, reopened, closed]
7-
paths:
8-
- 'packages/tdesign-web-components/package.json'
9-
- 'packages/tdesign-web-components-chat/package.json'
10-
issue_comment:
11-
types: [edited]
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
1210

1311
jobs:
14-
generator:
12+
publish:
13+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release/')
1514
runs-on: ubuntu-latest
16-
if: >
17-
github.event_name == 'pull_request' &&
18-
github.event.pull_request.merged == false &&
19-
startsWith(github.head_ref, 'release/')
2015
steps:
21-
- run: echo "The head of this PR starts with 'release/'"
22-
- uses: actions/checkout@v6
23-
- uses: TDesignOteam/tdesign-changelog-action@main
24-
id: changelog
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
- name: Add comment
28-
uses: peter-evans/create-or-update-comment@v5
16+
- uses: actions/checkout@v7
17+
18+
- uses: pnpm/action-setup@v6
19+
20+
- uses: actions/setup-node@v7
2921
with:
30-
issue-number: ${{ github.event.pull_request.number }}
31-
body: |
32-
${{ steps.changelog.outputs.changelog }}
33-
comment_add_log:
34-
runs-on: ubuntu-latest
35-
if: >
36-
github.event_name == 'issue_comment'
37-
&& github.event.issue.pull_request
38-
&& github.event.sender.login == github.event.issue.user.login
39-
&& startsWith(github.event.comment.body, '## 🌈 ')
40-
steps:
41-
- id: comment
42-
shell: bash
43-
run: |
44-
result=$(curl ${{github.event.issue.pull_request.url}} -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}")
45-
headrefreg='"ref": "(release/[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2})",'
46-
if [[ $result =~ $headrefreg ]]
47-
then
48-
echo "属于 release pr 的 comment ${BASH_REMATCH[1]}"
49-
else
50-
echo "不属于 release pr 的 comment" && exit 1
51-
fi
52-
echo "::set-output name=branch::${BASH_REMATCH[1]}"
53-
# zsh $match[1]
54-
- uses: actions/checkout@v6
22+
node-version-file: .node-version
23+
24+
- run: pnpm install
25+
26+
- run: pnpm run generate
27+
28+
- run: pnpm --filter "tdesign-icons-*" run --if-present build
29+
30+
- uses: actions/setup-node@v7
5531
with:
56-
ref: ${{ steps.comment.outputs.branch }}
57-
- name: Commit and push if needed
58-
env:
59-
BODY: ${{ github.event.comment.body }}
60-
run: |
61-
CHANGELOG=packages/tdesign-web-components/CHANGELOG.md
62-
txt=$(cat "$CHANGELOG")
63-
echo "${txt%%##*}$BODY${txt##*---}" > "$CHANGELOG"
64-
git add .
65-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
66-
git config --local user.name "github-actions[bot]"
67-
git commit -m "chore: changelog's changes"
68-
git push
69-
echo "💾 pushed changelog's changes"
70-
merge_tag:
71-
runs-on: ubuntu-latest
72-
if: >
73-
github.event_name == 'pull_request' &&
74-
github.event.pull_request.merged == true &&
75-
startsWith(github.head_ref, 'release/')
76-
steps:
77-
- uses: actions/checkout@v6
32+
node-version: 24
33+
34+
- uses: TDesignOteam/flow-pilot-action@develop
7835
with:
79-
ref: develop
80-
token: ${{ secrets.PERSONAL_TOKEN }}
81-
- name: tag and push if needed
82-
run: |
83-
data=$(cat packages/tdesign-web-components/package.json)
84-
re="\"version\": \"([^\"]*)\""
85-
[[ $data =~ $re ]]
86-
echo "${BASH_REMATCH[1]}"
87-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
88-
git config --local user.name "github-actions[bot]"
89-
git tag ${BASH_REMATCH[1]}
90-
git push origin ${BASH_REMATCH[1]}
91-
echo "pushed tag ${BASH_REMATCH[1]}"
36+
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
37+
packages: |
38+
@tdesign/web-components
39+
@tdesign/web-components-chat

.github/workflows/tag-push.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)