Python Release #24
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Python Release | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
working-directory: ./python | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install | |
run: | | |
pip3 install poetry | |
- name: run lint | |
run: make lint | |
- name: run UT | |
run: make test | |
- name: Build artifacts | |
run: make build | |
- name: Build docs | |
run: make doc | |
- name: Check Version | |
id: check-version | |
run: | | |
echo version=$(poetry version --short) >> $GITHUB_OUTPUT | |
- name: cleanup before release | |
run: | | |
zip -r ./output/docs.zip ./output/docs/_build/html | |
rm -rf ./output/docs | |
- name: get pr collection # 获取tag之间的pr内容,输出为md文件的路径 | |
id: get-pr | |
env: | |
REPO: ${{ github.repository }} | |
QF_GITHUB_TOKEN: ${{ secrets.QF_GITHUB_TOKEN }} | |
NEW_TAG: ${{ format('py/v{0}', steps.check-version.outputs.version) }} | |
run: | | |
bash ./scripts/release_note.sh py | |
echo body_path=$(realpath ./release_note.md) >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ format('Python v{0}', steps.check-version.outputs.version) }} | |
artifacts: "output/*" | |
token: ${{ secrets.QF_GITHUB_TOKEN }} | |
draft: false | |
bodyFile: ${{ steps.get-pr.outputs.body_path }} # 引入上文生成的release_note.md作为内容 | |
generateReleaseNotes: false | |
tag: ${{ format('py/v{0}', steps.check-version.outputs.version) }} | |
prerelease: ${{ contains(steps.check-version.outputs.version, 'rc') }} | |
commit: main | |
- name: release to pypi | |
env: | |
TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
export TAG_NAME=${{ steps.check-version.outputs.version }} | |
echo "Triggered by tag: $TAG_NAME" | |
bash ./scripts/release_github.sh | |