Skip to content

Commit 2d0a532

Browse files
committed
Add PyPI publish workflow and package metadata
- Add publish.yml for manual PyPI release (patch/minor/major) - Add classifiers, keywords, URLs to pyproject.toml - Uses PYPI_TOKEN secret for publishing
1 parent 96382e8 commit 2d0a532

2 files changed

Lines changed: 120 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
id-token: write # For PyPI trusted publishing
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v4
35+
36+
- name: Get current version
37+
id: current_version
38+
run: |
39+
CURRENT_VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
40+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
41+
echo "Current version: $CURRENT_VERSION"
42+
43+
- name: Bump version
44+
id: bump_version
45+
run: |
46+
CURRENT="${{ steps.current_version.outputs.version }}"
47+
IFS='.' read -r major minor patch <<< "$CURRENT"
48+
49+
case "${{ github.event.inputs.version_bump }}" in
50+
major)
51+
NEW_VERSION="$((major + 1)).0.0"
52+
;;
53+
minor)
54+
NEW_VERSION="${major}.$((minor + 1)).0"
55+
;;
56+
patch)
57+
NEW_VERSION="${major}.${minor}.$((patch + 1))"
58+
;;
59+
esac
60+
61+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
62+
echo "Bumping version: $CURRENT -> $NEW_VERSION"
63+
64+
- name: Update version in pyproject.toml
65+
run: |
66+
sed -i 's/^version = ".*"/version = "${{ steps.bump_version.outputs.new_version }}"/' pyproject.toml
67+
cat pyproject.toml | grep "^version"
68+
69+
- name: Build package
70+
run: |
71+
uv build
72+
73+
- name: Publish to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
with:
76+
password: ${{ secrets.PYPI_TOKEN }}
77+
print-hash: true
78+
79+
- name: Commit version bump
80+
run: |
81+
git config user.name "github-actions[bot]"
82+
git config user.email "github-actions[bot]@users.noreply.github.com"
83+
git add pyproject.toml
84+
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
85+
git push
86+
87+
- name: Create GitHub Release
88+
uses: actions/create-release@v1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
tag_name: v${{ steps.bump_version.outputs.new_version }}
93+
release_name: v${{ steps.bump_version.outputs.new_version }}
94+
body: |
95+
Release version ${{ steps.bump_version.outputs.new_version }}
96+
97+
Published to PyPI: https://pypi.org/project/sqlmesh-openlineage/${{ steps.bump_version.outputs.new_version }}/
98+
draft: false
99+
prerelease: false

pyproject.toml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,32 @@ description = "OpenLineage integration for SQLMesh - emit lineage to Marquez"
55
readme = "README.md"
66
requires-python = ">= 3.9"
77
license = { text = "MIT" }
8-
authors = [{ name = "Sidequery" }]
8+
authors = [
9+
{ name = "Sidequery", email = "hello@sidequery.com" }
10+
]
11+
keywords = ["sqlmesh", "openlineage", "marquez", "data-lineage", "data-engineering"]
12+
classifiers = [
13+
"Development Status :: 4 - Beta",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Topic :: Database",
22+
"Topic :: Software Development :: Libraries :: Python Modules",
23+
]
924
dependencies = [
1025
"sqlmesh>=0.100.0",
1126
"openlineage-python>=1.0.0",
1227
]
1328

29+
[project.urls]
30+
Homepage = "https://github.com/sidequery/sqlmesh-openlineage"
31+
Repository = "https://github.com/sidequery/sqlmesh-openlineage"
32+
Issues = "https://github.com/sidequery/sqlmesh-openlineage/issues"
33+
1434
[project.optional-dependencies]
1535
dev = [
1636
"pytest",

0 commit comments

Comments
 (0)