Custom dist

This commit is contained in:
Jesse Farebrother 2019-12-05 16:25:02 -07:00
parent ae9c4b332a
commit 4f4304928f
3 changed files with 23 additions and 4 deletions

View file

@ -86,6 +86,20 @@ The action invocation in this case would look like:
repository_url: https://test.pypi.org/legacy/ repository_url: https://test.pypi.org/legacy/
``` ```
## Target Directory
You can change the default target directory of `dist/`
to any directory of your liking. The action invocation
would now look like:
```yml
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
dist: custom-dir/
```
## License ## License

View file

@ -12,6 +12,10 @@ inputs:
repository_url: repository_url:
description: The repository URL to use description: The repository URL to use
required: false required: false
dist:
description: The target directory for distribution
required: false
default: dist
branding: branding:
color: yellow color: yellow
icon: upload-cloud icon: upload-cloud
@ -22,3 +26,4 @@ runs:
- ${{ inputs.user }} - ${{ inputs.user }}
- ${{ inputs.password }} - ${{ inputs.password }}
- ${{ inputs.repository_url }} - ${{ inputs.repository_url }}
- ${{ inputs.dist }}

View file

@ -17,14 +17,14 @@ then
fi fi
if [[ if [[
! -d dist/ || ! -d ${INPUT_DIST%%/}/ ||
"`ls -l dist/*.tar.gz dist/*.whl`" == "total 0" "`ls -l ${INPUT_DIST%%/}/*.tar.gz ${INPUT_DIST%%/}/*.whl`" == "total 0"
]] ]]
then then
>&2 echo \ >&2 echo \
[WARNING]: \ [WARNING]: \
It looks like there are no Python distribution packages to \ It looks like there are no Python distribution packages to \
publish in the '"dist/"' directory. Please verify that they \ publish in the directory '"${INPUT_DIST%%/}/"'. Please verify that they \
are in place should you face this problem. are in place should you face this problem.
fi fi
@ -32,4 +32,4 @@ fi
TWINE_USERNAME="$INPUT_USER" \ TWINE_USERNAME="$INPUT_USER" \
TWINE_PASSWORD="$INPUT_PASSWORD" \ TWINE_PASSWORD="$INPUT_PASSWORD" \
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \ TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
exec twine upload dist/* exec twine upload ${INPUT_DIST%%/}/*