diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml deleted file mode 100644 index 567d3a4..0000000 --- a/.github/workflows/publish-pypi.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Manual PyPI publish backfill for an already-created release tag. -name: Publish PyPI - -on: - workflow_dispatch: - inputs: - ref: - description: Git ref to build and publish - required: true - default: v0.2.0 - -permissions: - contents: read - id-token: write - -jobs: - publish: - runs-on: ubuntu-latest - environment: pypi - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - ref: ${{ inputs.ref }} - - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: "3.12" - - name: Install build tools - run: pip install build - - name: Build - run: python -m build - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7cf64d3..dafa93e 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -3,6 +3,12 @@ name: Release Please on: push: branches: [main] + workflow_dispatch: + inputs: + ref: + description: Git ref to build and publish + required: true + default: v0.2.0 permissions: contents: write @@ -10,6 +16,7 @@ permissions: jobs: release-please: + if: github.event_name == 'push' runs-on: ubuntu-latest outputs: release_created: ${{ steps.release.outputs.release_created }} @@ -23,7 +30,7 @@ jobs: test: needs: release-please - if: needs.release-please.outputs.release_created + if: always() && (github.event_name == 'workflow_dispatch' || needs.release-please.outputs.release_created == 'true') runs-on: ubuntu-latest strategy: fail-fast: true @@ -31,6 +38,8 @@ jobs: python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.sha }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: @@ -42,7 +51,7 @@ jobs: publish: needs: [release-please, test] - if: needs.release-please.outputs.release_created + if: always() && needs.test.result == 'success' && (github.event_name == 'workflow_dispatch' || needs.release-please.outputs.release_created == 'true') runs-on: ubuntu-latest environment: pypi permissions: @@ -50,6 +59,8 @@ jobs: id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.sha }} - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: