Skip to content

Commit 2ae9caf

Browse files
committed
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.
2 parents ae9c4b3 + 19c0fbd commit 2ae9caf

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ The action invocation in this case would look like:
8686
repository_url: https://test.pypi.org/legacy/
8787
```
8888

89+
### Customizing target package dists directory
90+
91+
You can change the default target directory of `dist/`
92+
to any directory of your liking. The action invocation
93+
would now look like:
94+
95+
```yml
96+
- name: Publish package to PyPI
97+
uses: pypa/gh-action-pypi-publish@master
98+
with:
99+
user: __token__
100+
password: ${{ secrets.pypi_password }}
101+
packages-dir: custom-dir/
102+
```
89103

90104
## License
91105

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ inputs:
1212
repository_url:
1313
description: The repository URL to use
1414
required: false
15+
packages-dir:
16+
description: The target directory for distribution
17+
required: false
18+
default: dist
1519
branding:
1620
color: yellow
1721
icon: upload-cloud
@@ -22,3 +26,4 @@ runs:
2226
- ${{ inputs.user }}
2327
- ${{ inputs.password }}
2428
- ${{ inputs.repository_url }}
29+
- ${{ inputs.packages-dir }}

twine-upload.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ then
1717
fi
1818

1919
if [[
20-
! -d dist/ ||
21-
"`ls -l dist/*.tar.gz dist/*.whl`" == "total 0"
20+
! -d ${INPUT_PACKAGES_DIR%%/}/ ||
21+
"`ls -l ${INPUT_PACKAGES_DIR%%/}/*.tar.gz ${INPUT_PACKAGES_DIR%%/}/*.whl`" == "total 0"
2222
]]
2323
then
2424
>&2 echo \
2525
[WARNING]: \
2626
It looks like there are no Python distribution packages to \
27-
publish in the '"dist/"' directory. Please verify that they \
27+
publish in the directory '"${INPUT_PACKAGES_DIR%%/}/"'. Please verify that they \
2828
are in place should you face this problem.
2929
fi
3030

3131

3232
TWINE_USERNAME="$INPUT_USER" \
3333
TWINE_PASSWORD="$INPUT_PASSWORD" \
3434
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
35-
exec twine upload dist/*
35+
exec twine upload ${INPUT_PACKAGES_DIR%%/}/*

0 commit comments

Comments
 (0)