mirror of
https://github.com/pypa/gh-action-pypi-publish.git
synced 2024-11-22 00:21:08 -05:00
Expose skip_existing
setting to the end-users
This commit is contained in:
parent
6a02ab807d
commit
00ef3b8182
3 changed files with 32 additions and 1 deletions
19
README.md
19
README.md
|
@ -111,6 +111,25 @@ check with:
|
|||
verify_metadata: false
|
||||
```
|
||||
|
||||
### Tolerating release package file duplicates
|
||||
|
||||
Sometimes, when you publish releases from multiple places, your workflow
|
||||
may hit race conditions. For example, when publishing from multiple CIs
|
||||
or even having workflows with the same steps triggered withing GitHub
|
||||
Actions CI/CD for different events concerning the same high-level act.
|
||||
|
||||
To facilitate this use-case, you may use `skip_existing` (disabled by
|
||||
default) setting as follows:
|
||||
|
||||
```yml
|
||||
with:
|
||||
skip_existing: true
|
||||
```
|
||||
|
||||
> **Pro tip**: try to avoid enabling this setting where possible. If you
|
||||
have steps for publishing to both PyPI and TestPyPI, consider only using
|
||||
it for the latter, having the former fail loudly on duplicates.
|
||||
|
||||
## License
|
||||
|
||||
The Dockerfile and associated scripts and documentation in this project
|
||||
|
|
|
@ -20,6 +20,12 @@ inputs:
|
|||
description: Check metadata before uploading
|
||||
required: false
|
||||
default: true
|
||||
skip_existing:
|
||||
description: >-
|
||||
Do not fail if a Python package distribution
|
||||
exists in the target package index
|
||||
required: false
|
||||
default: false
|
||||
branding:
|
||||
color: yellow
|
||||
icon: upload-cloud
|
||||
|
@ -32,3 +38,4 @@ runs:
|
|||
- ${{ inputs.repository_url }}
|
||||
- ${{ inputs.packages_dir }}
|
||||
- ${{ inputs.verify_metadata }}
|
||||
- ${{ inputs.skip_existing }}
|
||||
|
|
|
@ -37,8 +37,13 @@ if [[ ${INPUT_VERIFY_METADATA,,} != "false" ]] ; then
|
|||
twine check ${INPUT_PACKAGES_DIR%%/}/*
|
||||
fi
|
||||
|
||||
TWINE_EXTRA_ARGS=
|
||||
if [[ ${INPUT_SKIP_EXISTING,,} != "false" ]] ; then
|
||||
TWINE_EXTRA_ARGS=--skip-existing
|
||||
fi
|
||||
|
||||
|
||||
TWINE_USERNAME="$INPUT_USER" \
|
||||
TWINE_PASSWORD="$INPUT_PASSWORD" \
|
||||
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
|
||||
exec twine upload ${INPUT_PACKAGES_DIR%%/}/*
|
||||
exec twine upload ${TWINE_EXTRA_ARGS} ${INPUT_PACKAGES_DIR%%/}/*
|
||||
|
|
Loading…
Reference in a new issue