Skip to content

Commit

Permalink
💚 完善自动发布
Browse files Browse the repository at this point in the history
  • Loading branch information
AzideCupric committed Apr 20, 2023
1 parent ad1353e commit 85b190a
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
template: $CHANGES
category-template: "### $TITLE"
name-template: "Release v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
change-template: "- $TITLE [@$AUTHOR](https://github.com/$AUTHOR) ([#$NUMBER]($URL))"
change-title-escapes: '\<&'
exclude-labels:
- "dependencies"
- "skip-changelog"
categories:
- title: "破坏性变更"
labels:
- "Breaking"
- title: "新功能"
labels:
- "feature"
- "enhancement"
- title: "Bug 修复"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "文档"
labels:
- "documentation"
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
39 changes: 39 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release Drafter

on:
pull_request_target:
branches:
- main
types:
- closed

jobs:
update-release-drafter:
runs-on: ubuntu-latest
concurrency:
group: pull-request-changelog
cancel-in-progress: true
steps:
- uses: actions/checkout@v3

- uses: release-drafter/release-drafter@v5
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master
with:
latest_changes_position: '# Change Log\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: |
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
34 changes: 34 additions & 0 deletions .github/workflows/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Trigger Release

on:
workflow_dispatch:

jobs:
archive:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: main

- name: Setup Python environment
uses: ./.github/actions/setup-python

- run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV

- name: Archive Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master
with:
archive_regex: '(?<=## )最近更新(?=\n)'
archive_title: ${{ env.TAG_NAME }}
commit_and_push: false

- name: Push Tag
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m ":bookmark: Release $(poetry version -s)"
git tag ${{ env.TAG_NAME }}
git push && git push --tags

0 comments on commit 85b190a

Please sign in to comment.