-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a4bdc1
commit 2190443
Showing
10 changed files
with
95 additions
and
122 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Publish to PyPI | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # make release | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.1.11 | ||
|
||
- run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Poetry build | ||
run: | | ||
poetry build | ||
- name: Upload Build Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: dist/ | ||
|
||
- name: Poetry Publish | ||
run: | | ||
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | ||
poetry publish | ||
- name: Make Release Draft | ||
run: | | ||
python ./extract-release-notes.py ${{ env.TAG_NAME }} | ||
gh release create ${{ env.TAG_NAME }} --draft --notes-file ./release-notes.md --title "✨ ${{ env.TAG_NAME }}" | ||
- name: Upload Artifacts to Release | ||
run: | | ||
gh release upload ${{ env.TAG_NAME }} --clobber dist/*.tar.gz dist/*.whl | ||
- 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 | ||
- name: Merge to master | ||
run: | | ||
git checkout master | ||
git merge dev --ff-only | ||
git push origin master |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,5 @@ dmypy.json | |
tmp/ | ||
*.tmp | ||
*.temp | ||
|
||
release-notes.md |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# 更改日志 | ||
|
||
## Unreleased | ||
## 未发布的更新 | ||
|
||
### 新增 | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
from itertools import dropwhile | ||
|
||
tag_name = sys.argv[1].removeprefix("v") | ||
|
||
with open("./docs/appendix/CHANGELOG.md", encoding="utf-8") as f: | ||
changelog_text = f.read() | ||
|
||
with open("./release-notes.md", encoding="utf-8", mode="w") as f: | ||
for line in dropwhile(lambda x: x != "## 未发布的更新", changelog_text.splitlines()): | ||
if line == "## 未发布的更新": | ||
continue | ||
if line.split(" ") and line.split(" ")[0] == "##": | ||
break | ||
print(line, file=f) | ||
|
||
with open("./docs/appendix/CHANGELOG.md", encoding="utf-8", mode="w") as f: | ||
f.write(changelog_text.replace("## 未发布的更新", f"## {tag_name}")) |