diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e078778..e36526e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,10 @@ name: Publish to PyPI on: + push: + branches: [main] + paths: + - 'pyproject.toml' workflow_dispatch: inputs: version: @@ -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 @@ -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 \ No newline at end of file + uv pip install twine + twine upload dist/* \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ceaca96..18c48c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",