Skip to content

Commit b9d3293

Browse files
committed
Automates release creation on PyPI publish
Adds a GitHub workflow step to automatically create a GitHub release when a new version is published to PyPI. This includes: - Setting write permissions for contents. - Retrieving the version number from the pyproject.toml file. - Creating a release with the version number as the tag and release name. - Generating a release body that includes instructions on how to install the new version.
1 parent 4800e4e commit b9d3293

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Publish to PyPI
33
on:
44
workflow_dispatch: # Manual trigger only
55

6+
permissions:
7+
contents: write # Needed to create releases
8+
69
jobs:
710
publish:
811
runs-on: ubuntu-latest
@@ -16,6 +19,13 @@ jobs:
1619
with:
1720
python-version: '3.11'
1821

22+
- name: Get version from pyproject.toml
23+
id: get_version
24+
run: |
25+
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
26+
echo "version=$VERSION" >> $GITHUB_OUTPUT
27+
echo "Version: $VERSION"
28+
1929
- name: Install dependencies
2030
run: |
2131
python -m pip install --upgrade pip
@@ -29,3 +39,17 @@ jobs:
2939
TWINE_USERNAME: __token__
3040
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
3141
run: twine upload dist/*
42+
43+
- name: Create GitHub Release
44+
uses: actions/create-release@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
tag_name: v${{ steps.get_version.outputs.version }}
49+
release_name: Release v${{ steps.get_version.outputs.version }}
50+
body: |
51+
Release version ${{ steps.get_version.outputs.version }}
52+
53+
Install with: `pip install agentic-search==${{ steps.get_version.outputs.version }}`
54+
draft: false
55+
prerelease: false

0 commit comments

Comments
 (0)