Skip to content

Commit

Permalink
update publish rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliotdoesprogramming committed Nov 28, 2024
1 parent 658f1d7 commit 5bcbcd7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Publish to PyPI

on:
push:
branches: [main]
paths:
- 'pyproject.toml'
workflow_dispatch:
inputs:
version:
Expand All @@ -13,7 +17,22 @@ permissions:
id-token: write

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.check.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: check
run: |
CHANGED=$(git diff HEAD^ HEAD -- pyproject.toml | grep '+version' || true)
echo "changed=${CHANGED:+true}" >> $GITHUB_OUTPUT
deploy:
needs: check-version
if: needs.check-version.outputs.should_publish == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -28,9 +47,13 @@ jobs:
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build and publish
- name: Build package
run: uv build

- name: Publish to PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
uv build --no-sources
uv publish
uv pip install twine
twine upload dist/*
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]

[project.urls]
Homepage = "https://github.com/eliotdoesprogramming/intent-service"
Repository = "https://github.com/eliotdoesprogramming/intent-service"

dependencies = [
"fastapi>=0.68.0,<1.0.0",
"pydantic>=2.4.2,<3.0.0",
Expand Down

0 comments on commit 5bcbcd7

Please sign in to comment.