Skip to content

Commit

Permalink
🚀 prepare workflows for 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGlassBlock committed Jun 7, 2022
1 parent 1a4bdc1 commit 2190443
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 122 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/api-docs.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/cf-preview-deploy.yml

This file was deleted.

File renamed without changes.
43 changes: 0 additions & 43 deletions .github/workflows/release-to-pypi.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/release.yml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@ dmypy.json
tmp/
*.tmp
*.temp

release-notes.md
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"betterem",
"cheatsheet",
"codehilite",
"commonmark",
"cooldown",
"crontabify",
"dataclass",
Expand Down Expand Up @@ -41,6 +42,7 @@
"MISRO",
"mkdocstrings",
"Netease",
"noreply",
"pycon",
"pymdownx",
"pypi",
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ QQ 交流群: [邀请链接](https://jq.qq.com/?_wv=1027&k=VXp6plBD)
[![Documentation Status](https://readthedocs.org/projects/graia-ariadne/badge/?version=latest)](https://graia.readthedocs.io/projects/ariadne/)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/GraiaProject/Ariadne/master.svg)](https://results.pre-commit.ci/latest/github/GraiaProject/Ariadne/master)

[![Build and deploy API Docs](https://github.com/GraiaProject/Ariadne/actions/workflows/api-docs.yml/badge.svg)](https://github.com/GraiaProject/Ariadne/actions/workflows/api-docs.yml)
[![Publish to PyPI](https://github.com/GraiaProject/Ariadne/actions/workflows/release-to-pypi.yml/badge.svg)](https://github.com/GraiaProject/Ariadne/actions/workflows/release-to-pypi.yml)
## 开发版资源 / 参与开发
[![文档构建](https://github.com/GraiaProject/Ariadne/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/GraiaProject/Ariadne/actions/workflows/deploy-docs.yml)
[![发布](https://github.com/GraiaProject/Ariadne/actions/workflows/release.yml/badge.svg)](https://github.com/GraiaProject/Ariadne/actions/workflows/release.yml)

[![开发分支文档](https://img.shields.io/badge/开发分支文档-here-000099)](https://graia-dev.rtfd.io/)
[![开发分支](https://img.shields.io/badge/开发分支-here-green)](https://github.com/GraiaProject/Ariadne/tree/dev)
[![开始开发](https://img.shields.io/badge/开始开发-here-003399)](./CONTRIBUTING.md)
## 参与开发

[贡献指南](./CONTRIBUTING.md)
2 changes: 1 addition & 1 deletion docs/appendix/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 更改日志

## Unreleased
## 未发布的更新

### 新增

Expand Down
18 changes: 18 additions & 0 deletions extract-release-notes.py
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}"))

0 comments on commit 2190443

Please sign in to comment.