From 2c52c6f02db56fca9901b9dbc595e86dde290983 Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Tue, 26 Nov 2024 11:09:47 +1100 Subject: [PATCH] ci: Fix publishing workflow issues (#1188) * ci: Refactor publish input * ci: Add ability skip test PyPI publishing * ci: Set attestations: false See https://github.com/pypa/gh-action-pypi-publish/issues/283 --- .github/workflows/pypi-publish.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 101f2cfe..14e3f13e 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -3,10 +3,15 @@ name: Publish Python Package on: workflow_dispatch: inputs: - publish: + publish_release: description: 'Create Production Release' required: true type: boolean + skip_test_pypi: + description: "Skip publishing to test PyPI" + required: false + type: boolean + default: "false" jobs: publish: @@ -25,7 +30,7 @@ jobs: fetch-depth: 0 - name: Get Next Version - if: ${{ github.event.inputs.publish }} + if: ${{ inputs.publish_release }} id: semver uses: ietf-tools/semver-action@v1 with: @@ -34,7 +39,7 @@ jobs: branch: main - name: Set Next Version Env Var - if: ${{ github.event.inputs.publish }} + if: ${{ inputs.publish_release }} env: NEXT_VERSION: ${{ steps.semver.outputs.next }} run: | @@ -42,7 +47,7 @@ jobs: - name: Create Draft Release uses: ncipollo/release-action@v1 - if: ${{ github.event.inputs.publish }} + if: ${{ inputs.publish_release }} with: prerelease: true draft: false @@ -124,6 +129,7 @@ jobs: makeLatest: true - name: Publish to Test PyPI + if: ${{ !inputs.skip_test_pypi }} uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ @@ -131,10 +137,12 @@ jobs: - name: Publish to PyPI if: env.SHOULD_DEPLOY == 'true' uses: pypa/gh-action-pypi-publish@release/v1 + with: + attestations: false build-base: runs-on: ubuntu-latest - if: github.event.inputs.publish + if: ${{ inputs.publish_release }} needs: [publish] permissions: contents: read