Skip to content

Commit 7dd2f90

Browse files
author
Pulkit-bristol
committed
Bump version to 0.1.0
1 parent 9385cf8 commit 7dd2f90

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
name: Publish to PyPI
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- 'v*' # Trigger on version tags like v0.1.0, v1.2.3, etc.
67
workflow_dispatch: # Allow manual trigger
78

89
jobs:
910
build-and-publish:
1011
runs-on: ubuntu-latest
1112
permissions:
1213
id-token: write # Required for trusted publishing
13-
contents: read
14+
contents: write # Required for creating releases
1415

1516
steps:
1617
- uses: actions/checkout@v4
@@ -23,6 +24,23 @@ jobs:
2324
- name: Install uv
2425
uses: astral-sh/setup-uv@v5
2526

27+
- name: Get version from pyproject.toml
28+
id: get_version
29+
run: |
30+
VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
echo "Package version: $VERSION"
33+
34+
- name: Verify tag matches version
35+
run: |
36+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
37+
PYPROJECT_VERSION="${{ steps.get_version.outputs.version }}"
38+
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
39+
echo "Error: Tag version ($TAG_VERSION) does not match pyproject.toml version ($PYPROJECT_VERSION)"
40+
exit 1
41+
fi
42+
echo "Version check passed: $TAG_VERSION"
43+
2644
- name: Install build dependencies
2745
run: uv pip install --system build twine
2846

@@ -32,6 +50,20 @@ jobs:
3250
- name: Check package
3351
run: twine check dist/*
3452

53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
name: Release v${{ steps.get_version.outputs.version }}
57+
body: |
58+
Release version ${{ steps.get_version.outputs.version }}
59+
60+
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/master/CHANGELOG.md) for details.
61+
files: |
62+
dist/*.whl
63+
dist/*.tar.gz
64+
draft: false
65+
prerelease: false
66+
3567
- name: Publish to PyPI
3668
uses: pypa/gh-action-pypi-publish@release/v1
3769
with:

0 commit comments

Comments
 (0)