From 677acf8795ee34c89c537fe08d198e8882bf8e8a Mon Sep 17 00:00:00 2001 From: 94dreamer <503633021@qq.com> Date: Mon, 14 Feb 2022 15:19:15 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20pr=20=E5=A2=9E=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=20&=20=E5=8E=BB=E6=8E=89push=20=E9=A2=84=E8=A7=88=20&=20?= =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8C=96=20preview=20=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/PULL_REQUEST_TEMPLATE.md | 52 +++++++++++++++++++++++++++ .github/workflows/preview-publish.yml | 15 ++++++++ .github/workflows/pull-request.yml | 29 +++++---------- .github/workflows/push.yml | 24 ------------- package.json | 6 ++-- 5 files changed, 79 insertions(+), 47 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/preview-publish.yml delete mode 100644 .github/workflows/push.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a97d15e --- /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/preview-publish.yml b/.github/workflows/preview-publish.yml new file mode 100644 index 0000000..364f99c --- /dev/null +++ b/.github/workflows/preview-publish.yml @@ -0,0 +1,15 @@ +# 文件名建议统一为 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/pull-request.yml b/.github/workflows/pull-request.yml index 25254a6..e456b38 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,28 +1,15 @@ +# 文件名建议统一为 pull-request.yml +# 应用 test-build.yml 的 demo + name: MAIN_PULL_REQUEST on: pull_request: branches: [develop, main] + types: [opened, synchronize, reopened] jobs: - MAIN_PULL_REQUEST: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Cache nodemodules - 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 }}- - - uses: actions/setup-node@v2 - with: - node-version: '16' - - run: npm install - shell: bash - - run: npm run lint + call-test-build: + uses: Tencent/tdesign/.github/workflows/test-build.yml@main + +# install lint \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 018af6b..0000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: All_ON_PUSH - -on: push - -jobs: - All_ON_PUSH: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: npm install - shell: bash - - run: echo '${{ github.ref }} ... ${{ github.sha }}' - - name: build-site - run: npm run build - - name: upload surge service and generate preview URL - id: deploy - run: | - export GITHUB_SHA=${{ github.sha }} - export GITHUB_SHA_SUB=${GITHUB_SHA: 0: 7 } - export DEPLOY_DOMAIN=https://preview-$GITHUB_SHA_SUB-tdesign-vue-next-starter.surge.sh - npx surge --project ./dist --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }} - echo the preview URL is $DEPLOY_DOMAIN - if: ${{ success() }} - - run: echo "🚀 This job's status is ${{ job.status }}." diff --git a/package.json b/package.json index 81e9ceb..26c567b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "lint:fix": "eslint --ext .vue,.js,jsx,.ts,.tsx ./ --max-warnings 0 --fix", "stylelint": "stylelint src/**/*.{html,vue,sass,less}", "stylelint:fix": "stylelint --fix src/**/*.{html,vue,vss,sass,less}", - "prepare": "husky install" + "prepare": "husky install", + "site:preview": "npm run build && cp -r dist _site", + "test": "echo \"no test specified,work in process\"" }, "dependencies": { "cz-conventional-changelog": "^3.3.0", @@ -81,4 +83,4 @@ "git add ." ] } -} +} \ No newline at end of file