-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish and create release from changelog
- Loading branch information
1 parent
38d44e3
commit f3a5f3d
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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,49 @@ | ||
name: Publish package to PyPI and create release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: | ||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
|
||
publish: | ||
name: Publish distribution to PyPI | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
environment: pypi_prod | ||
needs: [build] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- name: Install flit | ||
run: | | ||
pip install flit | ||
- name: Publish the distibution to PyPI | ||
run: flit publish | ||
env: | ||
FLIT_INDEX_URL: https://upload.pypi.org/legacy/ | ||
FLIT_USERNAME: __token__ | ||
FLIT_PASSWORD: ${{ secrets. PYPI_API_TOKEN }} | ||
|
||
release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
needs: [publish] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Extract release notes | ||
id: extract-release-notes | ||
uses: ffurrer2/extract-release-notes@v1 | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release create --notes '${{ steps.extract-release-notes.outputs.release_notes }}' --title ${{ github.ref_name }} ${{ github.ref_name }} |