🔀 Merge pull request #805

CI: 减少 action 冗余运行
This commit is contained in:
Ju4tCode 2022-02-16 17:59:33 +08:00 committed by GitHub
commit 83ff7a3a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 28 deletions

View File

@ -4,13 +4,15 @@ on:
push: push:
branches: branches:
- master - master
- dev
pull_request: pull_request:
jobs: jobs:
test: test:
name: Test Coverage name: Test Coverage
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
concurrency:
group: test-coverage-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy: strategy:
matrix: matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"] python-version: ["3.7", "3.8", "3.9", "3.10"]

View File

@ -14,11 +14,17 @@ jobs:
update-release-draft: update-release-draft:
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency:
group: pull-request-changelog
cancel-in-progress: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- uses: release-drafter/release-drafter@v5 - uses: release-drafter/release-drafter@v5
id: release-drafter id: release-drafter
env: env:
@ -29,7 +35,20 @@ jobs:
with: with:
changelog_file: website/src/pages/changelog.md changelog_file: website/src/pages/changelog.md
latest_changes_position: '# 更新日志\n\n' latest_changes_position: '# 更新日志\n\n'
latest_changes_title: '## 最近更新'
replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )'
changelog_body: ${{ steps.release-drafter.outputs.body }} changelog_body: ${{ steps.release-drafter.outputs.body }}
commit_and_push: false
- name: Commit and Push
run: |
yarn prettier
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m ":memo: Update changelog"
git push
release: release:
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View File

@ -28,10 +28,14 @@ jobs:
uses: docker://ghcr.io/nonebot/auto-changelog:master uses: docker://ghcr.io/nonebot/auto-changelog:master
with: with:
changelog_file: website/src/pages/changelog.md changelog_file: website/src/pages/changelog.md
archive_regex: '(?<=## )最近更新(?=\n)'
archive_title: ${{ env.TAG_NAME }} archive_title: ${{ env.TAG_NAME }}
commit_and_push: false
- name: Archive Files - name: Archive Files
run: yarn archive $(poetry version -s) run: |
yarn archive $(poetry version -s)
yarn prettier
- name: Push Tag - name: Push Tag
run: | run: |

View File

@ -4,21 +4,18 @@ on:
push: push:
branches: branches:
- master - master
- dev
pull_request_target: pull_request_target:
jobs: jobs:
publish: publish:
if: github.event_name == 'push'
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency:
group: website-deploy-${{ github.ref }}
cancel-in-progress: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
if: github.event_name == 'push'
- uses: actions/checkout@v2
if: github.event_name != 'push'
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python Environment - name: Setup Python Environment
uses: ./.github/actions/setup-python uses: ./.github/actions/setup-python
@ -35,23 +32,52 @@ jobs:
- name: Get Branch Name - name: Get Branch Name
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Get Deploy Name - name: Deploy to Netlify
if: github.event_name == 'push' uses: nwtgck/actions-netlify@v1
run: | with:
echo "DEPLOY_NAME=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV publish-dir: "./website/build"
echo "PRODUCTION=${{ env.BRANCH_NAME == 'master' }}" >> $GITHUB_ENV production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}"
enable-commit-comment: false
alias: ${{ env.BRANCH_NAME }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
preview:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
concurrency:
group: pull-request-preview-${{ github.event.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python Environment
uses: ./.github/actions/setup-python
- name: Setup Node Environment
uses: ./.github/actions/setup-node
- name: Build API Doc
uses: ./.github/actions/build-api-doc
- name: Build Doc
run: yarn build
- name: Get Deploy Name - name: Get Deploy Name
if: github.event_name != 'push'
run: | run: |
echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV echo "DEPLOY_NAME=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV
echo "PRODUCTION=false" >> $GITHUB_ENV
- name: Deploy to Netlify - name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1 uses: nwtgck/actions-netlify@v1
with: with:
publish-dir: "./website/build" publish-dir: "./website/build"
production-deploy: ${{ env.PRODUCTION }} production-deploy: false
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}" deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}"
enable-commit-comment: false enable-commit-comment: false

View File

@ -1,8 +1,8 @@
ci: ci:
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks" autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks"
autofix_prs: true autofix_prs: true
autoupdate_branch: dev autoupdate_branch: master
autoupdate_schedule: weekly autoupdate_schedule: monthly
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
repos: repos:
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort

View File

@ -4,7 +4,7 @@ description: Changelog
# 更新日志 # 更新日志
## Latest changes ## 最近更新
### 💫 杂项 ### 💫 杂项
@ -13,14 +13,7 @@ description: Changelog
### 🍻 插件发布 ### 🍻 插件发布
- Plugin: pixiv.net p站查询图片 [@yanyongyu](https://github.com/yanyongyu) ([#803](https://github.com/nonebot/nonebot2/pull/803)) - Plugin: pixiv.net p 站查询图片 [@yanyongyu](https://github.com/yanyongyu) ([#803](https://github.com/nonebot/nonebot2/pull/803))
## Latest changes
### 💫 杂项
- CI: fix ci permission error [@yanyongyu](https://github.com/yanyongyu) ([#802](https://github.com/nonebot/nonebot2/pull/802))
- CI: 添加更新日志自动更新 action [@yanyongyu](https://github.com/yanyongyu) ([#799](https://github.com/nonebot/nonebot2/pull/799))
## v2.0.0-beta.2 ## v2.0.0-beta.2