Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
description: Name of the package on PyPI
required: true
type: string
version:
description: Version on PyPI, when it differs from the tag without its leading v
required: false
default: ''
type: string
request_id:
description: Only used by ppt to find this run
required: false
Expand All @@ -30,26 +35,32 @@ concurrency:

jobs:
sign:
name: Sign the PyPI files of the release
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
id-token: write
contents: write # upload the bundles and missing files to the release
id-token: write # the OIDC token Sigstore signs with
env:
GH_REPO: ${{ github.repository }}
TAG: ${{ inputs.tag }}
PACKAGE: ${{ inputs.package }}
PYPI_VERSION: ${{ inputs.version }}
steps:
- name: Validate inputs
run: |
if ! [[ "$TAG" =~ ^v?[0-9][0-9A-Za-z.+!-]*$ ]]; then
if ! [[ "$TAG" =~ ^v?[0-9][0-9A-Za-z._+!-]*$ ]]; then
echo "Invalid tag input" >&2
exit 1
fi
if ! [[ "$PACKAGE" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
echo "Invalid package input" >&2
exit 1
fi
if [ -n "$PYPI_VERSION" ] && ! [[ "$PYPI_VERSION" =~ ^v?[0-9][0-9A-Za-z._+!-]*$ ]]; then
echo "Invalid version input" >&2
exit 1
fi

- name: Read the release
env:
Expand Down Expand Up @@ -95,7 +106,10 @@ jobs:

TAG: str = os.environ['TAG']
PACKAGE: str = os.environ['PACKAGE']
VERSION: str = TAG[1:] if TAG.startswith('v') else TAG
# The version input when ppt passes one, else the tag without its v.
VERSION: str = os.environ.get('PYPI_VERSION') or (
TAG[1:] if TAG.startswith('v') else TAG
)
URL_TEMPLATE: str = os.environ.get(
'PYPI_JSON_URL', 'https://pypi.org/pypi/{package}/{version}/json'
)
Expand Down
Loading