diff --git a/.github/ISSUE_TEMPLATE/bug-report.zh-CN.yml b/.github/ISSUE_TEMPLATE/bug-report.zh-CN.yml new file mode 100644 index 00000000..61de8b34 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.zh-CN.yml @@ -0,0 +1,79 @@ +name: 反馈 Bug +description: 通过 github 模板进行 Bug 反馈。 +title: "[组件名称] 描述问题的标题" +body: + - type: markdown + attributes: + value: | + # 欢迎你的参与 + tdesign 的 Issue 列表接受 bug 报告或是新功能请求。也可加入官方社区: + + 在发布一个 Issue 前,请确保: + - 在 [常见问题](https://tdesign.tencent.com/about/faq)、[更新日志](https://tdesign.tencent.com/about/release) 和 [旧Issue列表](https://github.com/Tencent/tdesign/issues?q=is%3Aissue) 中搜索过你的问题。(你的问题可能已有人提出,也可能已在最新版本中被修正) + - 如果你发现一个已经关闭的旧 Issue 在最新版本中仍然存在,不要在旧 Issue 下面留言,请建一个新的 issue。 + + - type: input + id: version + attributes: + label: tdesign 版本 + description: 请检查在最新项目版本中能否重现此 issue。 + placeholder: 请填写 + validations: + required: true + + - type: input + id: reproduce + attributes: + label: 重现链接 + description: 请提供尽可能精简的 CodePen、CodeSandbox 或 GitHub 仓库的链接。请不要填无关链接,否则你的 Issue 将被关闭。 + placeholder: 请填写 + + - type: textarea + id: reproduceSteps + attributes: + label: 重现步骤 + description: 请清晰的描述重现该 Issue 的步骤,这能帮助我们快速定位问题。没有清晰重现步骤将不会被修复,标有 'need reproduction' 的 Issue 在 7 天内不提供相关步骤,将被关闭。 + placeholder: 请填写 + + - type: textarea + id: expect + attributes: + label: 期望结果 + placeholder: 请填写 + + - type: textarea + id: actual + attributes: + label: 实际结果 + placeholder: 请填写 + + - type: input + id: frameworkVersion + attributes: + label: 框架版本 + placeholder: Vue(3.2.0) + + - type: input + id: browsersVersion + attributes: + label: 浏览器版本 + placeholder: Chrome(8.213.231.123) + + - type: input + id: systemVersion + attributes: + label: 系统版本 + placeholder: MacOS(11.2.3) + + - type: input + id: nodeVersion + attributes: + label: Node版本 + placeholder: 请填写 + + - type: textarea + id: remarks + attributes: + label: 补充说明 + description: 可以是遇到这个 bug 的业务场景、上下文等信息。 + placeholder: 请填写 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..cec7613e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: 使用 issue-helper 新建 + url: https://Tencent.github.io/tdesign/issue-helper/?lang=zh-CN&repo=Tencent/tdesign + about: 使用 https://Tencent.github.io/tdesign/issue-helper/ 创建 issue,其中包含 bug 和 feature,表单提交更加严格。 diff --git a/.github/ISSUE_TEMPLATE/feature-report.zh-CN.yml b/.github/ISSUE_TEMPLATE/feature-report.zh-CN.yml new file mode 100644 index 00000000..b99397e1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-report.zh-CN.yml @@ -0,0 +1,30 @@ +name: 反馈新功能 +description: 通过 github 模板进行新功能反馈。 +title: "[组件名称] 描述问题的标题" +body: + - type: markdown + attributes: + value: | + # 欢迎你的参与 + tdesign 的 Issue 列表接受 bug 报告或是新功能请求。也可加入官方社区: + + 在发布一个 Issue 前,请确保: + - 在 [常见问题](https://tdesign.tencent.com/about/faq)、[更新日志](https://tdesign.tencent.com/about/release) 和 [旧Issue列表](https://github.com/Tencent/tdesign/issues?q=is%3Aissue) 中搜索过你的问题。(你的问题可能已有人提出,也可能已在最新版本中被修正) + - 如果你发现一个已经关闭的旧 Issue 在最新版本中仍然存在,不要在旧 Issue 下面留言,请建一个新的 issue。 + + - type: textarea + id: functionContent + attributes: + label: 这个功能解决了什么问题 + description: 请详尽说明这个需求的用例和场景。最重要的是:解释清楚是怎样的用户体验需求催生了这个功能上的需求。我们将考虑添加在现有 API 无法轻松实现的功能。新功能的用例也应当足够常见。 + placeholder: 请填写 + validations: + required: true + + - type: textarea + id: functionalExpectations + attributes: + label: 你建议的方案是什么 + placeholder: 请填写 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/new-component.zh-CN.md b/.github/ISSUE_TEMPLATE/new-component.zh-CN.md new file mode 100644 index 00000000..05b48991 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-component.zh-CN.md @@ -0,0 +1,45 @@ +--- +name: 新组件 +about: 新组件招募 +title: '' +labels: '' +assignees: '' + +--- + + +## 组件名称中英文 + + +### 交互稿 + + +交互稿: + +### 设计稿 + +设计稿: + +已实现的技术栈: + +- [ ] tdesign-vue +- [ ] tdesign-vue-next +- [ ] tdesign-react + +### 参与贡献 + +如果你想要认领组件开发,请在本 issue 中评论认领并预估提交 PR 时间,例: + +> “我认领这个组件 tdesign-vue 仓库的实现任务,预计 x 日后提交” + +请尽量在预期时间内完成,超期后 PMC 同学可能会联系其他同学接手实现。 + +详细提交过程请参考:[如何贡献](https://tdesign.tencent.com/about/contributing)。 + +欢迎填写[《贡献者加入意向收集》](https://wj.qq.com/s2/9772260/7cbe/)问卷加入 TDesign 贡献者群,参与过程中遇到的各类问题可以得到实时解答和指引。 + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..a97d15e4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,52 @@ + + +### 🤔 这个 PR 的性质是? + +- [ ] 日常 bug 修复 +- [ ] 新特性提交 +- [ ] 文档改进 +- [ ] 演示代码改进 +- [ ] 组件样式/交互改进 +- [ ] CI/CD 改进 +- [ ] 重构 +- [ ] 代码风格优化 +- [ ] 测试用例 +- [ ] 分支合并 +- [ ] 其他 + +### 🔗 相关 Issue + + + +### 💡 需求背景和解决方案 + + + +### 📝 更新日志 + + + +- fix(组件名称): 处理问题或特性描述 ... + +- [ ] 本条 PR 不需要纳入 Changelog + +### ☑️ 请求合并前的自查清单 + +⚠️ 请自检并全部**勾选全部选项**。⚠️ + +- [ ] 文档已补充或无须补充 +- [ ] 代码演示已提供或无须提供 +- [ ] TypeScript 定义已补充或无须补充 +- [ ] Changelog 已提供或无须提供 diff --git a/.github/workflows/demo/pr-compressed-size.yml b/.github/workflows/demo/pr-compressed-size.yml new file mode 100644 index 00000000..544b3138 --- /dev/null +++ b/.github/workflows/demo/pr-compressed-size.yml @@ -0,0 +1,17 @@ +name: Compressed Size + +on: + pull_request: + types: [opened, synchronize] + +jobs: + compressed-size: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: 94dreamer/compressed-size-action@master + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + pattern: "./dist/**/*.{js,css}" \ No newline at end of file diff --git a/.github/workflows/demo/preview-publish.demo.yml b/.github/workflows/demo/preview-publish.demo.yml new file mode 100644 index 00000000..98d21a87 --- /dev/null +++ b/.github/workflows/demo/preview-publish.demo.yml @@ -0,0 +1,16 @@ +# 文件名建议统一为 preview-publish +# 应用 preview.yml 的 demo + +# name: PREVIEW_PUBLISH + +# on: +# workflow_run: +# workflows: ["MAIN_PULL_REQUEST"] +# types: +# - completed + +# jobs: +# call-preview: +# uses: Tencent/tdesign/.github/workflows/preview.yml@main +# secrets: +# TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} diff --git a/.github/workflows/demo/pull-request.demo.yml b/.github/workflows/demo/pull-request.demo.yml new file mode 100644 index 00000000..b60b10aa --- /dev/null +++ b/.github/workflows/demo/pull-request.demo.yml @@ -0,0 +1,14 @@ +# 文件名建议统一为 pull-request.yml +# 应用 test-build.yml 的 demo +# 要求 package.json 提供 lint test site:preview + +# name: MAIN_PULL_REQUEST + +# on: +# pull_request: +# branches: [develop, main] +# types: [opened, synchronize, reopened] + +# jobs: +# call-test-build: +# uses: Tencent/tdesign/.github/workflows/test-build.yml@main \ No newline at end of file diff --git a/.github/workflows/demo/tag-push.demo.yml b/.github/workflows/demo/tag-push.demo.yml new file mode 100644 index 00000000..3820a904 --- /dev/null +++ b/.github/workflows/demo/tag-push.demo.yml @@ -0,0 +1,13 @@ +# 文件名建议统一为 tag-push.yml +# 应用 publish.yml 的 demo + +# name: TAG_PUSH + +# on: create + +# jobs: +# call-publish: +# uses: Tencent/tdesign/.github/workflows/publish.yml@main +# secrets: +# TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} +# TDESIGN_NPM_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/file-copy-repos.yml b/.github/workflows/file-copy-repos.yml new file mode 100644 index 00000000..6269b7a1 --- /dev/null +++ b/.github/workflows/file-copy-repos.yml @@ -0,0 +1,72 @@ +name: Copy to Repos + +on: + workflow_dispatch: + +jobs: + call-preview-1: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-vue + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-2: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-vue-next + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-3: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-react + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-4: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-miniprogram + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-5: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-common + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-6: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-starter-cli + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-7: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-vue-starter + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-8: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-vue-next-starter + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-9: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-icons + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-10: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-react-starter + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + call-preview-11: + uses: Tencent/tdesign/.github/workflows/file-copy.yml@main + with: + repo: tdesign-mobile-vue + secrets: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/file-copy.yml b/.github/workflows/file-copy.yml new file mode 100644 index 00000000..d952931c --- /dev/null +++ b/.github/workflows/file-copy.yml @@ -0,0 +1,31 @@ +name: Copy to One Repo +# wanted/duplicate/reply/close + +on: + workflow_call: + inputs: + repo: + required: true + type: string + secrets: + PERSONAL_TOKEN: + required: true + +jobs: + copy: + runs-on: ubuntu-latest + steps: + - name: Copycat + uses: andstor/copycat-action@v3 + with: + personal_token: ${{ secrets.PERSONAL_TOKEN }} + src_path: /.github/workflows + src_branch: main + dst_path: /.github/ + dst_branch: develop + dst_owner: Tencent + dst_repo_name: ${{ inputs.repo }} + filter: '**/*.temp.yml' + username: 94dreamer + email: 503633021@qq.com + commit_message: 'ci: update files "/.github/workflows" from "Tencent/tdesign"' \ No newline at end of file diff --git a/.github/workflows/issue-assignees.temp.yml b/.github/workflows/issue-assignees.temp.yml new file mode 100644 index 00000000..a0ea92b2 --- /dev/null +++ b/.github/workflows/issue-assignees.temp.yml @@ -0,0 +1,53 @@ +# force copy from tencent/tdesign +name: Issue Add Assigness + +on: + issues: + types: [opened, edited] + +jobs: + mark-duplicate: + runs-on: ubuntu-latest + steps: + - if: github.event.label.name != 'new component' && github.event.label.name != 'issueshoot' + - uses: wow-actions/auto-comment@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + issuesOpened: | + 👋 @{{ author }},感谢给 TDesign 提出了 issue。 + 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。 + + # https://docs.github.com/cn/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues + - uses: 94dreamer/issue-assignees@main + id: assignees + with: + project_name: ${{github.event.repository.name}} + issue_title: ${{github.event.issue.title}} + + - run: echo ${{ steps.assignees.outputs.contributors }} + - name: Add assigness + if: steps.assignees.outputs.contributors != '' + uses: actions-cool/issues-helper@v3 + with: + actions: "add-assignees" + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + assignees: ${{ steps.assignees.outputs.contributors }} + + - run: | + contributors=${{ steps.assignees.outputs.contributors }} + contributorstring=${contributors//,/ @} + echo "::set-output name=string::@$contributorstring" + id: contributors + + - name: 通知贡献者 + if: steps.assignees.outputs.contributors != '' + uses: actions-cool/maintain-one-comment@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + ♥️ 有劳 ${{ steps.contributors.outputs.string }} 尽快确认问题。 + 确认有效后将下一步计划和可能需要的时间回复给 @${{ github.event.issue.user.login }} 。 + + number: ${{ github.event.issue.number }} + body-include: "" diff --git a/.github/workflows/issue-help-wanted.temp.yml b/.github/workflows/issue-help-wanted.temp.yml new file mode 100644 index 00000000..94e9bbdf --- /dev/null +++ b/.github/workflows/issue-help-wanted.temp.yml @@ -0,0 +1,22 @@ +# force copy from tencent/tdesign +name: Issue Help wanted +on: + issues: + types: + - labeled +jobs: + add-comment: + if: github.event.label.name == 'help wanted' + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Add comment + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.issue.number }} + body: | + 任何人都可以处理此问题。 + **请务必在您的 `pull request` 中引用此问题。** :sparkles: + 感谢你的贡献! :sparkles: + reactions: heart \ No newline at end of file diff --git a/.github/workflows/issue-mark-duplicate.temp.yml b/.github/workflows/issue-mark-duplicate.temp.yml new file mode 100644 index 00000000..30177232 --- /dev/null +++ b/.github/workflows/issue-mark-duplicate.temp.yml @@ -0,0 +1,19 @@ +# force copy from tencent/tdesign +# 当在 issue 的 comment 回复类似 `Duplicate of #111` 这样的话,issue 将被自动打上 重复提交标签 并且 cloese +name: Issue Mark Duplicate + +on: + issue_comment: + types: [created, edited] + +jobs: + mark-duplicate: + runs-on: ubuntu-latest + steps: + - name: mark-duplicate + uses: actions-cool/issues-helper@v2 + with: + actions: "mark-duplicate" + token: ${{ secrets.GITHUB_TOKEN }} + duplicate-labels: "duplicate" + close-issue: true diff --git a/.github/workflows/issue-reply.temp.yml b/.github/workflows/issue-reply.temp.yml new file mode 100644 index 00000000..271a94f5 --- /dev/null +++ b/.github/workflows/issue-reply.temp.yml @@ -0,0 +1,21 @@ +# force copy from tencent/tdesign +# 当被打上 Need Reproduce 标签时候,自动提示需要重现实例 + +name: ISSUE_REPLY + +on: + issues: + types: [labeled] + +jobs: + issue-reply: + runs-on: ubuntu-latest + steps: + - name: Need Reproduce + if: github.event.label.name == 'Need Reproduce' + uses: actions-cool/issues-helper@v2 + with: + actions: 'create-comment' + issue-number: ${{ github.event.issue.number }} + body: | + 你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。请确保选择准确的版本。 diff --git a/.github/workflows/issue-synchronize.temp.yml b/.github/workflows/issue-synchronize.temp.yml new file mode 100644 index 00000000..04f79db0 --- /dev/null +++ b/.github/workflows/issue-synchronize.temp.yml @@ -0,0 +1,17 @@ +# force copy from tencent/tdesign +name: Issue Synchronize + +on: + issues: + types: [opened, reopened] + +jobs: + synchronize: + runs-on: ubuntu-latest + steps: + # https://docs.github.com/cn/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issues + - uses: TDesignOteam/create-report@main + with: + wxhook: ${{ secrets.WX_HOOK_URL }} + token: ${{ secrets.GITHUB_TOKEN }} + type: 'issue' \ No newline at end of file diff --git a/.github/workflows/issues-dailyclose-schedule.yml b/.github/workflows/issues-dailyclose-schedule.yml new file mode 100644 index 00000000..861234f6 --- /dev/null +++ b/.github/workflows/issues-dailyclose-schedule.yml @@ -0,0 +1,19 @@ +# 国际标准时间+8 +# 每天issue和pr的关闭情况 +name: issues-dailyclose-schedule + +on: + workflow_dispatch: + schedule: + - cron: "0 2 * * *" + +jobs: + create-report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: TDesignOteam/create-report@main + with: + wxhook: ${{ secrets.WX_HOOK_URL }} + token: ${{ secrets.GIT_TOKEN_L }} + type: 'close' diff --git a/.github/workflows/issues-dailynew-schedule.yml b/.github/workflows/issues-dailynew-schedule.yml new file mode 100644 index 00000000..7655be5f --- /dev/null +++ b/.github/workflows/issues-dailynew-schedule.yml @@ -0,0 +1,19 @@ +# 国际标准时间+8 +# 每天 issue 新增情况 +name: issues-dailyclose-schedule + +on: + workflow_dispatch: + schedule: + - cron: "0 9 * * *" + +jobs: + create-report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: TDesignOteam/create-report@main + with: + wxhook: ${{ secrets.WX_HOOK_URL }} + token: ${{ secrets.GIT_TOKEN_L }} + type: 'new' diff --git a/.github/workflows/issues-statistics-schedule.yml b/.github/workflows/issues-statistics-schedule.yml new file mode 100644 index 00000000..535addcb --- /dev/null +++ b/.github/workflows/issues-statistics-schedule.yml @@ -0,0 +1,19 @@ +# 国际标准时间+8 +# 每天issue和pr的待处理情况 +name: issues-statistics-schedule + +on: + workflow_dispatch: + schedule: + - cron: "0 6 * * *" + +jobs: + create-report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: TDesignOteam/create-report@main + with: + wxhook: ${{ secrets.WX_HOOK_URL }} + token: ${{ secrets.GIT_TOKEN_L }} + type: 'xiaolv' diff --git a/.github/workflows/pr-spelling.template.yml b/.github/workflows/pr-spelling.template.yml new file mode 100644 index 00000000..e634e5c5 --- /dev/null +++ b/.github/workflows/pr-spelling.template.yml @@ -0,0 +1,14 @@ +# force copy from tencent/tdesign +name: pr-spell-check +on: [pull_request] + +jobs: + run: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check spelling + uses: crate-ci/typos@master + with: + config: .github/workflows/typos-config.toml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..3cb6d044 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,91 @@ +name: PREVIEW + +on: + workflow_call: + secrets: + TDESIGN_SURGE_TOKEN: + required: true + +jobs: + preview-success: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + steps: + - name: download pr artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: pr + - name: save PR id + id: pr + run: echo "id=$(> $GITHUB_OUTPUT + - name: download _site artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: _site + - run: | + unzip _site.zip + + - name: Upload surge service and generate preview URL + id: deploy + run: | + repository=${{github.repository}} + project_name=${repository#*/} + export DEPLOY_DOMAIN=https://preview-pr${{ steps.pr.outputs.id }}-$project_name.surge.sh + npx surge --project ./_site --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} + echo the preview URL is $DEPLOY_DOMAIN + echo "url=$DEPLOY_DOMAIN" >> $GITHUB_OUTPUT + - name: update status comment + uses: actions-cool/maintain-one-comment@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + 完成 + + + number: ${{ steps.pr.outputs.id }} + body-include: "" + + - run: | + rm -rf _site/ + + - name: The job failed + if: ${{ failure() }} + uses: actions-cool/maintain-one-comment@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + [失败](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}) + + number: ${{ steps.pr.outputs.id }} + body-include: "" + + preview-failed: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'failure' + steps: + - name: download pr artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + name: pr + - name: save PR id + id: pr + run: echo "id=$(> $GITHUB_OUTPUT + - name: The job failed + uses: actions-cool/maintain-one-comment@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + body: | + [失败](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}) + + number: ${{ steps.pr.outputs.id }} + body-include: "" diff --git a/.github/workflows/publish-components.yml b/.github/workflows/publish-components.yml new file mode 100644 index 00000000..155da11b --- /dev/null +++ b/.github/workflows/publish-components.yml @@ -0,0 +1,45 @@ +name: PUBLISH_COMPONENTS + +on: + push: + branches: [main] + pull_request_target: + types: [closed] + +jobs: + modify-components: + runs-on: ubuntu-latest + outputs: + components-changed: ${{ steps.components-changed.outputs.changed }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 100 + - uses: marceloprado/has-changed-path@v1 + id: components-changed + with: + paths: packages/components/package.json + - run: echo components changed=${{ steps.components-changed.outputs.changed }} + + publish-components: + runs-on: ubuntu-latest + needs: modify-components + if: needs.modify-components.outputs.components-changed == 'true' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + registry-url: "https://registry.npmjs.org" + - uses: pnpm/action-setup@v2 + with: + version: 6.0.2 + - run: pnpm install + - run: cd packages/components && npm run build + - run: cd packages/components && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }} + - run: echo '${{ github.ref }} ... ${{ github.ref_name }}' + - if: steps.publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..666bd91e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,77 @@ +name: PUBLISH + +on: + workflow_call: + secrets: + PERSONAL_TOKEN: + required: false + TDESIGN_SURGE_TOKEN: + required: true + TDESIGN_NPM_TOKEN: + required: true + +jobs: + TAG_PUSH: + runs-on: ubuntu-latest + if: github.event.ref_type == 'tag' + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-node@v2 + with: + node-version: 18 + - uses: actions/cache@v2 + env: + cache-name: cache-nodemodules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - run: npm install + + - name: Build site + run: npm run site:preview + - name: upload surge service + id: deploy + run: | + repository=${{github.repository}} + project_name=${repository#*/} + ref_name=${{ github.ref_name }} + tag_name=${ref_name//./_} + export DEPLOY_DOMAIN=https://$tag_name-$project_name.surge.sh + npx surge --project _site --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} + echo $DEPLOY_DOMAIN + - run: echo "🍏 This job's status is ${{ job.status }}." + - run: npm run build + - name: publish + id: publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.TDESIGN_NPM_TOKEN }} + tag: ${{ contains(github.ref_name, 'beta') && 'beta' || 'latest' }} + - if: steps.publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" + UPDATE_OFFICIAL_WEBSITE: + runs-on: ubuntu-latest + if: github.event.ref_type == 'tag' + steps: + - uses: actions/checkout@v3 + with: + ref: main + fetch-depth: 0 + token: ${{ secrets.PERSONAL_TOKEN }} + submodules: recursive + - name: update official website + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git status + git fetch origin + git merge origin/develop + git push origin main + \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..99a281a7 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,39 @@ +name: MAIN_PULL_REQUEST + +on: + push: + branches: [main] + pull_request_target: + types: [closed] + +jobs: + modify-services: + runs-on: ubuntu-latest + outputs: + services-changed: ${{ steps.services-changed.outputs.changed }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 100 + - uses: marceloprado/has-changed-path@v1 + id: services-changed + with: + paths: services + - run: echo services changed=${{ steps.services-changed.outputs.changed }} + + upload-services: + runs-on: ubuntu-latest + needs: modify-services + if: needs.modify-services.outputs.services-changed == 'true' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + - run: node ./services/update-components-notice.js + - run: sleep 3s + - run: | + export DEPLOY_DOMAIN=https://tdesign-site-services.surge.sh + npx surge --project ./services --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} + echo the preview URL is $DEPLOY_DOMAIN + echo "::set-output name=url::$DEPLOY_DOMAIN" diff --git a/.github/workflows/service-update-schedule.yml b/.github/workflows/service-update-schedule.yml new file mode 100644 index 00000000..facd784f --- /dev/null +++ b/.github/workflows/service-update-schedule.yml @@ -0,0 +1,25 @@ +# 国际标准时间+8 +# 每周更新组件发布信息 +name: service-update-schedule + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 5" + +jobs: + create-report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + - run: node ./services/update-components-notice.js + - run: sleep 3s + - run: | + export DEPLOY_DOMAIN=https://tdesign-site-services.surge.sh + npx surge --project ./services --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} + ls services + echo the preview URL is $DEPLOY_DOMAIN + echo "::set-output name=url::$DEPLOY_DOMAIN" diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 00000000..facdd50e --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,94 @@ +name: TEST_AND_BUILD + +on: + workflow_call: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: check_github_primary_email + run: | + log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "默认邮箱 $log_emails 校验非法,可以去 https://github.com/settings/emails 更改" && exit 2;else echo "邮箱 $log_emails 校验通过";fi + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: check_local_email + run: | + log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "本地提交邮箱 $log_emails 校验非法,需要本地更改重新提交" && exit 2;else echo "邮箱 $log_emails 校验通过";fi + + test: + # needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-node@v2 + with: + node-version: 18 + - uses: actions/cache@v2 + env: + cache-name: cache-nodemodules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - run: npm install + + - run: npm run lint + - run: npm run test + # upload report to codecov + - uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + site: + runs-on: ubuntu-latest + # needs: test + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: actions/setup-node@v2 + with: + node-version: 18 + - uses: actions/cache@v2 + env: + cache-name: cache-nodemodules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - run: npm install + + - name: Build site + run: npm run site:preview + + - run: | + zip -r _site.zip _site + + - name: upload _site artifact + uses: actions/upload-artifact@v2 + with: + name: _site + path: _site.zip + retention-days: 5 + + - name: Save PR number + if: ${{ always() }} + run: echo ${{ github.event.number }} > ./pr-id.txt + + - name: Upload PR number + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: pr + path: ./pr-id.txt diff --git a/.github/workflows/typos-config.toml b/.github/workflows/typos-config.toml new file mode 100644 index 00000000..b59c18f9 --- /dev/null +++ b/.github/workflows/typos-config.toml @@ -0,0 +1,5 @@ +[default.extend-words] +vertx = "vertx" + +[files] +extend-exclude = ["**/lib/**","**/spline/**","contributor.html","README.md","README_zh-CN.md","docsearch.min.js","*.svg"] \ No newline at end of file