Skip to content

Commit

Permalink
Publish and create release from changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelkanda committed Jan 11, 2024
1 parent 38d44e3 commit f3a5f3d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/publish.yml
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 }}

0 comments on commit f3a5f3d

Please sign in to comment.