🔖 Release 2.4.0 #69
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Setup Node Environment | |
uses: ./.github/actions/setup-node | |
- uses: release-drafter/release-drafter@v6 | |
id: release-drafter | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_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 github-actions[bot] | |
git config user.email github-actions[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 | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- 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 | |
- 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 | |
- uses: release-drafter/release-drafter@v6 | |
with: | |
name: Release ${{ steps.version.outputs.TAG_NAME }} 🌈 | |
tag: ${{ steps.version.outputs.TAG_NAME }} | |
publish: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Package | |
run: poetry build | |
- name: Publish Package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Publish Package to GitHub Release | |
run: gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |