Skip to content

Commit

Permalink
✨ feat: release
Browse files Browse the repository at this point in the history
  • Loading branch information
nichuanfang committed Oct 13, 2023
1 parent be2accd commit e957997
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 23 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 'CI'
on:
push:
tags:
- 'v*'

jobs:
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/[email protected]
with:
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feat"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix"]
},
{
"title": "## 📝 Documentation",
"labels": ["docs"]
},
{
"title": "## 🎨 Style",
"labels": ["style"]
},
{
"title": "## 🧰 Refactor",
"labels": ["refactor"]
},
{
"title": "## 🚨 Perf",
"labels": ["perf"]
},
{
"title": "## 🧪 Tests",
"labels": ["test"]
},
{
"title": "## 📦 Build",
"labels": ["build"]
},
{
"title": "## 📦 CI",
"labels": ["ci"]
},
{
"title": "## 📦 Chore",
"labels": ["chore"]
}
]
}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create Release
uses: mikepenz/[email protected] #softprops/action-gh-release
with:
body: ${{steps.github_release.outputs.changelog}}
token: ${{ secrets.GH_TOKEN }}
53 changes: 31 additions & 22 deletions .github/workflows/release_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,29 @@ jobs:
python setup.py sdist bdist_wheel
twine upload dist/*
# 生成发行说明
- name: Generate Release Notes
id: gen_release_notes
uses: actions/github-script@v3
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
script: |
const compareCommits = await github.repos.compareCommits({
owner: context.repo.owner,
repo: context.repo.repo,
base: context.payload.before,
head: context.payload.after
});
const commits = compareCommits.data.commits.map(commit => `- ${commit.commit.message}`);
return commits.join('\n');
# # 生成发行说明
# - name: Generate Release Notes
# id: gen_release_notes
# uses: actions/github-script@v3
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# with:
# script: |
# const compareCommits = await github.repos.compareCommits({
# owner: context.repo.owner,
# repo: context.repo.repo,
# base: context.payload.before,
# head: context.payload.after
# });
# # 根据分类生成发行说明
# const commits = compareCommits.data.commits.map(commit => `- ${commit.commit.message}`);
# return commits.join('\n');

# 将发行说明写入文件 该文件会在后面的步骤中使用
- name: build changelog
id: build_changelog
run: |
echo "changelog=$(echo "${{ steps.gen_release_notes.outputs.result }}" | grep -E '^\- (init|feat|fix|docs|style|refactor|perf|test|build|ci|chore)(\(.+\))?: .{1,50}$')" >> "$GITHUB_OUTPUT"
# # 将发行说明写入文件 该文件会在后面的步骤中使用
# - name: build changelog
# id: build_changelog
# run: |
# echo "changelog=${{ steps.gen_release_notes.outputs.result }}" >> "$GITHUB_OUTPUT"

# 创建release
- name: Create Release
Expand All @@ -91,6 +92,14 @@ jobs:
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }}
body: ${{steps.build_changelog.outputs.changelog}}
# body: ${{steps.build_changelog.outputs.changelog}}
draft: false
prerelease: false

# - name: 'Build Changelog'
# id: github_release
# uses: mikepenz/release-changelog-builder-action@v4
# with:
# configuration: 'configs/configuration_repo.json'
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='music-tool-kit',
version='0.6.2',
version='0.6.3',
description='A tool kit for music download and clip',
long_description_content_type='text/markdown',
long_description=readme,
Expand Down

0 comments on commit e957997

Please sign in to comment.