|
1 | | -name: Auto Release |
| 1 | +name: auto-release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | 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 |
12 | 10 |
|
13 | 11 | jobs: |
14 | | - generator: |
| 12 | + publish: |
| 13 | + if: github.event.pull_request.merged && startsWith(github.head_ref, 'release/') |
15 | 14 | 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/') |
20 | 15 | 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 |
29 | 21 | 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 |
55 | 31 | 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 |
78 | 35 | 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 |
0 commit comments