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
|
|
|
|
|
2024-02-05 13:35:34 +08:00
|
|
|
- uses: release-drafter/release-drafter@v6
|
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
|
2023-10-01 15:15:32 +08:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: write
|
2022-02-14 21:01:39 +08:00
|
|
|
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
|
|
|
|
|
2023-10-01 15:15:32 +08:00
|
|
|
- name: Get Version
|
|
|
|
id: version
|
|
|
|
run: |
|
|
|
|
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
|
|
|
|
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Check Version
|
|
|
|
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
|
|
|
|
run: exit 1
|
2022-02-14 21:01:39 +08:00
|
|
|
|
2024-02-05 13:35:34 +08:00
|
|
|
- uses: release-drafter/release-drafter@v6
|
2022-02-14 21:01:39 +08:00
|
|
|
with:
|
2023-10-01 15:15:32 +08:00
|
|
|
name: Release ${{ steps.version.outputs.TAG_NAME }} 🌈
|
|
|
|
tag: ${{ steps.version.outputs.TAG_NAME }}
|
2022-02-14 21:01:39 +08:00
|
|
|
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
|
|
|
|
2023-10-01 15:15:32 +08:00
|
|
|
- name: Build Package
|
2022-02-14 21:01:39 +08:00
|
|
|
run: |
|
|
|
|
poetry build
|
2023-09-14 00:21:06 +08:00
|
|
|
|
|
|
|
- name: Publish package to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
2022-02-14 21:01:39 +08:00
|
|
|
|
2023-10-01 15:15:32 +08:00
|
|
|
- name: Publish package to GitHub
|
|
|
|
run: |
|
|
|
|
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
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
|
|
|
|
cd packages/nonebot-plugin-docs/
|
2023-10-01 15:15:32 +08:00
|
|
|
poetry version ${{ steps.version.outputs.VERSION }}
|
2022-02-14 21:01:39 +08:00
|
|
|
poetry build
|
2023-09-14 00:21:06 +08:00
|
|
|
|
|
|
|
- name: Publish Doc Package to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
with:
|
2023-10-01 15:31:27 +08:00
|
|
|
packages-dir: packages/nonebot-plugin-docs/dist/
|
2023-10-01 15:15:32 +08:00
|
|
|
|
|
|
|
- name: Publish Doc Package to GitHub
|
|
|
|
run: |
|
|
|
|
cd packages/nonebot-plugin-docs/
|
|
|
|
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|