Skip to content

Commit 5bcbcd7

Browse files
update publish rules
1 parent 658f1d7 commit 5bcbcd7

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/publish.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Publish to PyPI
22

33
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'pyproject.toml'
48
workflow_dispatch:
59
inputs:
610
version:
@@ -13,7 +17,22 @@ permissions:
1317
id-token: write
1418

1519
jobs:
20+
check-version:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
should_publish: ${{ steps.check.outputs.changed }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 2
28+
- id: check
29+
run: |
30+
CHANGED=$(git diff HEAD^ HEAD -- pyproject.toml | grep '+version' || true)
31+
echo "changed=${CHANGED:+true}" >> $GITHUB_OUTPUT
32+
1633
deploy:
34+
needs: check-version
35+
if: needs.check-version.outputs.should_publish == 'true'
1736
runs-on: ubuntu-latest
1837
steps:
1938
- uses: actions/checkout@v4
@@ -28,9 +47,13 @@ jobs:
2847
curl -LsSf https://astral.sh/uv/install.sh | sh
2948
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3049
31-
- name: Build and publish
50+
- name: Build package
51+
run: uv build
52+
53+
- name: Publish to PyPI
3254
env:
33-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
55+
TWINE_USERNAME: __token__
56+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
3457
run: |
35-
uv build --no-sources
36-
uv publish
58+
uv pip install twine
59+
twine upload dist/*

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ classifiers = [
1818
"Topic :: Scientific/Engineering :: Artificial Intelligence",
1919
]
2020

21+
[project.urls]
22+
Homepage = "https://github.com/eliotdoesprogramming/intent-service"
23+
Repository = "https://github.com/eliotdoesprogramming/intent-service"
24+
2125
dependencies = [
2226
"fastapi>=0.68.0,<1.0.0",
2327
"pydantic>=2.4.2,<3.0.0",

0 commit comments

Comments
 (0)