-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:Tencent/tdesign into main
- Loading branch information
Showing
8 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 仓库。请确保选择准确的版本。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 文件名建议统一为 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 | ||
# with: | ||
# project_name: 'tdesign-main' | ||
# workflow_run_event: github.event.workflow_run.event | ||
# workflow_run_conclusion: github.event.workflow_run.conclusion | ||
# workflow_run_workflow_id: github.event.workflow_run.workflow_id | ||
# secrets: | ||
# TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: PREVIEW | ||
|
||
on: | ||
workflow_call: | ||
# inputs: | ||
# workflow_run_event: | ||
# required: true | ||
# type: string | ||
# default: 'pull_request' | ||
# 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 }} | ||
name: pr | ||
- name: save PR id | ||
id: pr | ||
run: echo "::set-output name=id::$(<pr-id.txt)" | ||
- name: download _site artifact | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: ${{ github.event.workflow_run.workflow_id }} | ||
workflow_conclusion: success | ||
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 "::set-output name=url::$$DEPLOY_DOMAIN" | ||
- name: update status comment | ||
uses: actions-cool/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
PR 预览产物在 ${{steps.deploy.outputs.url}} | ||
number: ${{ steps.pr.outputs.id }} | ||
- run: | | ||
rm -rf _site/ | ||
- name: The job failed | ||
if: ${{ failure() }} | ||
uses: actions-cool/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
PR 预览生成失败。 | ||
number: ${{ steps.pr.outputs.id }} | ||
|
||
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 }} | ||
name: pr | ||
- name: save PR id | ||
id: pr | ||
run: echo "::set-output name=id::$(<pr-id.txt)" | ||
- name: The job failed | ||
uses: actions-cool/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
Deploy PR Preview failed, ${{ github.event.workflow_run.conclusion }} at ${{ github.event.workflow_run.workflow_id }}. | ||
number: ${{ steps.pr.outputs.id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: TAG_PUSH | ||
|
||
on: create | ||
|
||
jobs: | ||
call-publish: | ||
uses: Tencent/tdesign/.github/workflows/publish.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: PUBLISH | ||
|
||
on: | ||
workflow_call: | ||
# inputs: | ||
# workflow_run_event: | ||
# required: true | ||
# type: string | ||
# default: 'pull_request' | ||
# secrets: | ||
# 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: 16 | ||
- 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#*/} | ||
export DEPLOY_DOMAIN=https://${{ github.ref_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 }} | ||
- if: steps.publish.outputs.type != 'none' | ||
run: | | ||
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 文件名建议统一为 pull-request.yml | ||
# 应用 test-build.yml 的 demo | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: TEST_AND_BUILD | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check_email | ||
run: | | ||
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo $log_emails && echo "邮箱校验非法" && exit 2;else echo "邮箱校验通过";fi | ||
shell: bash | ||
test: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- 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 | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- 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 |