diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f5e80a2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,54 @@ +name: Publish + +on: + release: + types: [published] + +env: + UV_VERSION: '0.8.15' + +permissions: + contents: write + id-token: write + +defaults: + run: + shell: bash + +jobs: + publish: + runs-on: ubuntu-22.04 + environment: + name: pypi + url: https://pypi.org/p/dynopsi + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.PUBLISH_PAT }} + + - name: Setup uv + uses: astral-sh/setup-uv@v6 + with: + version: ${{ env.UV_VERSION }} + + - name: Set version from release tag + run: | + VERSION="${{ github.event.release.tag_name }}" + VERSION="${VERSION#v}" + uv version "$VERSION" + + - name: Commit version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add pyproject.toml + git commit -m "chore: bump version to ${{ github.event.release.tag_name }}" + git push origin main + + - name: Build + run: uv build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1