name: Release Drafter on: push: tags: - v* pull_request_target: branches: - master types: - closed jobs: update-release-draft: if: github.event_name == 'pull_request_target' runs-on: ubuntu-latest concurrency: group: pull-request-changelog cancel-in-progress: true steps: - name: Generate token id: generate-token uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_KEY }} - uses: actions/checkout@v4 with: token: ${{ steps.generate-token.outputs.token }} - name: Setup Node Environment uses: ./.github/actions/setup-node - uses: release-drafter/release-drafter@v5 id: release-drafter env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Update Changelog uses: docker://ghcr.io/nonebot/auto-changelog:master with: changelog_file: website/src/pages/changelog.md latest_changes_position: '# 更新日志\n\n' latest_changes_title: "## 最近更新" replace_regex: '(?<=## 最近更新\n)[\s\S]*?(?=\n## )' changelog_body: ${{ steps.release-drafter.outputs.body }} commit_and_push: false - name: Commit and Push run: | yarn prettier git config user.name noneflow[bot] git config user.email 129742071+noneflow[bot]@users.noreply.github.com git add . git diff-index --quiet HEAD || git commit -m ":memo: Update changelog" git push release: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Generate token id: generate-token uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_KEY }} - uses: actions/checkout@v4 - 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: ${{ steps.generate-token.outputs.token }} - name: Build and Publish Package run: | poetry build gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - 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: 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/