2022-02-14 21:01:39 +08:00
|
|
|
name: Release Drafter
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
2022-02-14 21:54:38 +08:00
|
|
|
pull_request_target:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
types:
|
|
|
|
- closed
|
2022-02-14 21:01:39 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
update-release-draft:
|
2022-02-14 21:54:38 +08:00
|
|
|
if: github.event_name == 'pull_request_target'
|
2022-02-14 21:01:39 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-02-16 14:17:33 +08:00
|
|
|
concurrency:
|
|
|
|
group: pull-request-changelog
|
|
|
|
cancel-in-progress: true
|
2022-02-14 21:01:39 +08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-02-16 11:49:45 +08:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GH_TOKEN }}
|
2022-02-14 21:01:39 +08:00
|
|
|
|
2022-02-16 14:28:44 +08:00
|
|
|
- name: Setup Node Environment
|
|
|
|
uses: ./.github/actions/setup-node
|
|
|
|
|
2022-02-14 21:01:39 +08:00
|
|
|
- uses: release-drafter/release-drafter@v5
|
2022-02-14 21:54:38 +08:00
|
|
|
id: release-drafter
|
2022-02-14 21:01:39 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2022-02-15 23:39:04 +08:00
|
|
|
- name: Update Changelog
|
2022-02-16 11:10:54 +08:00
|
|
|
uses: docker://ghcr.io/nonebot/auto-changelog:master
|
2022-02-15 23:39:04 +08:00
|
|
|
with:
|
|
|
|
changelog_file: website/src/pages/changelog.md
|
|
|
|
latest_changes_position: '# 更新日志\n\n'
|
2022-02-16 17:51:17 +08:00
|
|
|
latest_changes_title: '## 最近更新'
|
|
|
|
replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )'
|
2022-02-15 23:39:04 +08:00
|
|
|
changelog_body: ${{ steps.release-drafter.outputs.body }}
|
2022-02-16 14:28:44 +08:00
|
|
|
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 .
|
2022-02-25 12:58:38 +08:00
|
|
|
git diff-index --quiet HEAD || git commit -m ":memo: Update changelog"
|
2022-02-16 14:28:44 +08:00
|
|
|
git push
|
|
|
|
|
2022-02-14 21:54:38 +08:00
|
|
|
|
2022-02-14 21:01:39 +08:00
|
|
|
release:
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- run: |
|
|
|
|
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- uses: release-drafter/release-drafter@v5
|
|
|
|
with:
|
|
|
|
name: Release ${{ env.TAG_NAME }} 🌈
|
|
|
|
tag: ${{ env.TAG_NAME }}
|
|
|
|
publish: true
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and Publish Package
|
|
|
|
run: |
|
|
|
|
poetry build
|
|
|
|
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}
|
|
|
|
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and Publish Doc Package
|
|
|
|
run: |
|
|
|
|
yarn build:plugin --out-dir ../packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
|
|
|
|
export NONEBOT_VERSION=`poetry version -s`
|
|
|
|
cd packages/nonebot-plugin-docs/
|
|
|
|
poetry version $NONEBOT_VERSION
|
|
|
|
poetry build
|
|
|
|
poetry publish -u ${{secrets.PYPI_USERNAME}} -p ${{secrets.PYPI_PASSWORD}}
|
|
|
|
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|