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:
|
2023-04-04 09:48:31 +08:00
|
|
|
- name: Generate token
|
|
|
|
id: generate-token
|
2023-09-11 12:52:59 +08:00
|
|
|
uses: tibdex/github-app-token@v2
|
2023-04-04 09:48:31 +08:00
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
|
2023-09-05 12:00:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-16 11:49:45 +08:00
|
|
|
with:
|
2023-04-04 09:48:31 +08:00
|
|
|
token: ${{ steps.generate-token.outputs.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:
|
2023-09-14 00:21:06 +08:00
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
2022-02-14 21:01:39 +08:00
|
|
|
|
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-07-08 12:24:48 +08:00
|
|
|
latest_changes_title: "## 最近更新"
|
2022-02-16 17:51:17 +08:00
|
|
|
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
|
2023-04-04 09:48:31 +08:00
|
|
|
git config user.name noneflow[bot]
|
|
|
|
git config user.email 129742071+noneflow[bot]@users.noreply.github.com
|
2022-02-16 14:28:44 +08:00
|
|
|
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:01:39 +08:00
|
|
|
release:
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-14 00:21:06 +08:00
|
|
|
- name: Generate token
|
|
|
|
id: generate-token
|
|
|
|
uses: tibdex/github-app-token@v2
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
|
2023-09-05 12:00:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-14 21:01:39 +08:00
|
|
|
|
|
|
|
- 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:
|
2023-09-14 00:21:06 +08:00
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
2022-02-14 21:01:39 +08:00
|
|
|
|
|
|
|
- name: Build and Publish Package
|
|
|
|
run: |
|
|
|
|
poetry build
|
|
|
|
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
2023-09-14 00:21:06 +08:00
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
|
|
|
- name: Publish package to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
2022-02-14 21:01:39 +08:00
|
|
|
|
|
|
|
- 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
|
|
|
|
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
2023-09-14 00:21:06 +08:00
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
|
|
|
- name: Publish Doc Package to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
with:
|
|
|
|
packages-dir: packages/nonebot-plugin-docs/
|