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