Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,29 @@
从用户角度描述具体变化,以及可能的 breaking change 和其他风险。
-->

- fix(组件名称): 处理问题或特性描述 ...

- [ ] 本条 PR 不需要纳入 Changelog

#### tdesign-miniprogram
<!--
- feat(组件名称): 处理问题或特性描述
-->



#### tdesign-uniapp
<!--
- feat(组件名称): 处理问题或特性描述
-->



#### tdesign-uniapp-chat
<!--
- feat(组件名称): 处理问题或特性描述
-->



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

⚠️ 请自检并全部**勾选全部选项**。⚠️
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/auto-changelog-callback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: auto-changelog-callback

on:
workflow_run:
workflows:
- auto-changelog
types:
- completed

jobs:
commit-changelog:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request_review' }}
runs-on: ubuntu-latest
steps:
- name: Download pr id
uses: dawidd6/action-download-artifact@v8
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: pr-id

- name: Output pr id
id: pr
run: echo "id=$(cat pr-id.txt)" >> $GITHUB_OUTPUT

- name: auto-changelog
uses: TDesignOteam/flow-pilot-action@develop
with:
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
packages: 'tdesign-miniprogram,tdesign-uniapp,tdesign-uniapp-chat'
pr_number: ${{ steps.pr.outputs.id }}
44 changes: 44 additions & 0 deletions .github/workflows/auto-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: auto-changelog

on:
pull_request:
types: [opened]

pull_request_review:
types: [submitted]

issue_comment:
types: [edited]

jobs:
changelog:
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- run: echo ${{ github.event.pull_request.number }} > pr-id.txt

- uses: actions/upload-artifact@v4
with:
name: pr-id
path: pr-id.txt
retention-days: 5

comment-release-changelog:
if: github.event.pull_request && startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
steps:
- name: auto-changelog
uses: TDesignOteam/flow-pilot-action@develop
with:
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
packages: 'tdesign-miniprogram,tdesign-uniapp,tdesign-uniapp-chat'

commit-changelog:
if: github.event.issue.pull_request
runs-on: ubuntu-latest
steps:
- name: auto-changelog
uses: TDesignOteam/flow-pilot-action@develop
with:
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
packages: 'tdesign-miniprogram,tdesign-uniapp,tdesign-uniapp-chat'
66 changes: 66 additions & 0 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: auto-publish

on:
release:
types: [created]

jobs:
publish-official-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
submodules: recursive
token: ${{ secrets.TDESIGN_BOT_TOKEN }}

- name: update official website
run: |
git config --local user.email "[email protected]"
git config --local user.name "tdesign-bot"
git status
git fetch origin
git merge origin/develop
git push origin main

publish-miniprogram:
if: startsWith(github.event.release.tag_name,'tdesign-miniprogram')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v6
with:
node-version: 18

- run: pnpm install

- run: pnpm build

- name: extract version
id: version
run: |
const tagName = '${{ github.event.release.tag_name }}'
const lastIndex = tagName.lastIndexOf('@');
const version = tagName.slice(lastIndex + 1);
echo "version=$version" >> $GITHUB_OUTPUT
shell: bash

- name: release miniprogram
uses: LeeJim/setup-miniprogram@main
with:
project_type: miniProgram
action_type: upload
project_path: ./_example
version: ${{ steps.version.outputs.version }}
es6: true
es7: true
minify: true
env:
MINI_APP_ID: ${{ secrets.TDESIGN_APP_ID }}
MINI_APP_PRIVATE_KEY: ${{ secrets.TDESIGN_MINI_KEY }}
112 changes: 28 additions & 84 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,39 @@
name: Auto Release
name: auto-release

on:
pull_request:
branches: [develop]
types: [opened, synchronize, reopened, closed]
paths:
- 'packages/tdesign-miniprogram/package.json'
issue_comment:
types: [edited]
types: [closed]

permissions:
contents: read
id-token: write

jobs:
generator:
publish:
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.merged == false &&
startsWith(github.head_ref, 'release/')
steps:
- run: echo "The head of this PR starts with 'release/'"
- uses: actions/checkout@v3
- name: Extract version
id: version
run: |
echo "version=$(node -p 'require("./packages/tdesign-miniprogram/package.json").version')" >> $GITHUB_OUTPUT
- uses: TDesignOteam/tdesign-changelog-action@main
id: changelog
- uses: actions/checkout@v4
with:
tag: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add comment
uses: peter-evans/create-or-update-comment@v1
submodules: recursive

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.changelog.outputs.changelog }}
comment_add_log:
runs-on: ubuntu-latest
if: >
github.event_name == 'issue_comment'
&& github.event.issue.pull_request
&& github.event.sender.login == github.event.issue.user.login
&& startsWith(github.event.comment.body, '## 🌈 ')
steps:
- id: comment
shell: bash
run: |
result=$(curl ${{github.event.issue.pull_request.url}} -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}")
headrefreg='"ref": "(release/[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2})",'
if [[ $result =~ $headrefreg ]]
then
echo "属于 release pr 的 comment ${BASH_REMATCH[1]}"
else
echo "不属于 release pr 的 comment" && exit 1
fi
echo "branch=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
# zsh $match[1]
- uses: actions/checkout@v3
node-version: 18

- run: pnpm install

- run: pnpm build

- run: pnpm run uniapp build:npm

- uses: actions/setup-node@v4
with:
ref: ${{ steps.comment.outputs.branch }}
- name: Commit and push if needed
env:
BODY: ${{ github.event.comment.body }}
run: |
txt=$(cat packages/tdesign-miniprogram/CHANGELOG.md)
echo "${txt%%##*}$BODY${txt##*---}" > packages/tdesign-miniprogram/CHANGELOG.md
git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "chore: changelog's changes"
git push
echo "💾 pushed changelog's changes"
merge_tag:
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
startsWith(github.head_ref, 'release/')
steps:
- uses: actions/checkout@v3
node-version: 24

- uses: TDesignOteam/flow-pilot-action@develop
with:
ref: develop
token: ${{ secrets.PERSONAL_TOKEN }}
- name: tag and push if needed
run: |
data=$(cat packages/tdesign-miniprogram/package.json)
re="\"version\": \"([^\"]*)\""
[[ $data =~ $re ]]
echo "${BASH_REMATCH[1]}"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag ${BASH_REMATCH[1]}
git push origin ${BASH_REMATCH[1]}
echo "pushed tag ${BASH_REMATCH[1]}"
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
packages: 'tdesign-miniprogram,tdesign-uniapp,tdesign-uniapp-chat'
59 changes: 0 additions & 59 deletions .github/workflows/tag-push.yml

This file was deleted.

Loading