Skip to content

Commit

Permalink
ci: Fix publishing workflow issues (#1188)
Browse files Browse the repository at this point in the history
* ci: Refactor publish input

* ci: Add ability skip test PyPI publishing

* ci: Set attestations: false

See pypa/gh-action-pypi-publish#283
  • Loading branch information
kesara authored Nov 26, 2024
1 parent 30e8346 commit 2c52c6f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -34,15 +39,15 @@ 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: |
echo "NEXT_VERSION=$next" >> $GITHUB_ENV
- name: Create Draft Release
uses: ncipollo/release-action@v1
if: ${{ github.event.inputs.publish }}
if: ${{ inputs.publish_release }}
with:
prerelease: true
draft: false
Expand Down Expand Up @@ -124,17 +129,20 @@ 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/

- 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
Expand Down

0 comments on commit 2c52c6f

Please sign in to comment.