Merge commit 'pull/origin/19'

This change adds an Action argument for specifying a custom directory
that contains package distributions to be uploaded.

It's called `packages-dir` now. The default value is `dist`.

Resolves #10.
This commit is contained in:
Sviatoslav Sydorenko 2019-12-06 13:47:16 +01:00
commit 2ae9caf08e
No known key found for this signature in database
GPG key ID: 9345E8FEA89CA455
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/
```
### Customizing target package dists 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 PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
packages-dir: custom-dir/
```
## License

View file

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

View file

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