From 1e52417b14411fd262713dd4a7702833a1233e5c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:09:48 +0100 Subject: [PATCH] fix: add python release action --- .github/workflows/release.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c47d4b..8e291c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,7 @@ on: - '*' permissions: contents: write + id-token: write jobs: changelog: name: Generate changelog @@ -34,10 +35,29 @@ jobs: run: gh release create ${{ github.ref_name }} -F ${{ needs.changelog.outputs.release_body }} --draft env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + package: + name: Package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v3 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + - name: Install the project + run: uv sync --all-extras + - name: Publish package + run: | + sed -i -e "s/0.0.0/${GITHUB_REF#refs/*/}/" pyproject.toml + uv build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 publish_release: name: Publish release runs-on: ubuntu-latest - needs: [create_draft_release, changelog] + needs: [create_draft_release, package] steps: - name: Checkout uses: actions/checkout@v4