From 4f4304928fc886cd021893f6defb1bd53d0a1e5a Mon Sep 17 00:00:00 2001 From: Jesse Farebrother Date: Thu, 5 Dec 2019 16:25:02 -0700 Subject: [PATCH 1/4] Custom dist --- README.md | 14 ++++++++++++++ action.yml | 5 +++++ twine-upload.sh | 8 ++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 49ffb71..d7942b2 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,20 @@ The action invocation in this case would look like: 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 diff --git a/action.yml b/action.yml index e4f2802..0ae4477 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,10 @@ inputs: repository_url: description: The repository URL to use required: false + dist: + 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.dist }} diff --git a/twine-upload.sh b/twine-upload.sh index 3fa073f..71fdeb4 100755 --- a/twine-upload.sh +++ b/twine-upload.sh @@ -17,14 +17,14 @@ then fi if [[ - ! -d dist/ || - "`ls -l dist/*.tar.gz dist/*.whl`" == "total 0" + ! -d ${INPUT_DIST%%/}/ || + "`ls -l ${INPUT_DIST%%/}/*.tar.gz ${INPUT_DIST%%/}/*.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_DIST%%/}/"'. 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_DIST%%/}/* From d7872a6165cacfd344935ff10d930b0c67ec14b2 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 6 Dec 2019 13:38:52 +0100 Subject: [PATCH 2/4] Change `dist` param to `packages-dir` --- README.md | 2 +- action.yml | 4 ++-- twine-upload.sh | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d7942b2..ab84b8a 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ would now look like: with: user: __token__ password: ${{ secrets.test_pypi_password }} - dist: custom-dir/ + packages-dir: custom-dir/ ``` ## License diff --git a/action.yml b/action.yml index 0ae4477..7caeb32 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: repository_url: description: The repository URL to use required: false - dist: + packages-dir: description: The target directory for distribution required: false default: dist @@ -26,4 +26,4 @@ runs: - ${{ inputs.user }} - ${{ inputs.password }} - ${{ inputs.repository_url }} - - ${{ inputs.dist }} + - ${{ inputs.packages-dir }} diff --git a/twine-upload.sh b/twine-upload.sh index 71fdeb4..5c3ca96 100755 --- a/twine-upload.sh +++ b/twine-upload.sh @@ -17,14 +17,14 @@ then fi if [[ - ! -d ${INPUT_DIST%%/}/ || - "`ls -l ${INPUT_DIST%%/}/*.tar.gz ${INPUT_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 directory '"${INPUT_DIST%%/}/"'. 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 ${INPUT_DIST%%/}/* + exec twine upload ${INPUT_PACKAGES_DIR%%/}/* From b645b1f9d3842bd0147375656328fb89c2eecc83 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 6 Dec 2019 13:42:24 +0100 Subject: [PATCH 3/4] Use a regular PyPI in the custom dist dir example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab84b8a..8250de5 100644 --- a/README.md +++ b/README.md @@ -93,11 +93,11 @@ to any directory of your liking. The action invocation would now look like: ```yml -- name: Publish package to TestPyPI +- name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@master with: user: __token__ - password: ${{ secrets.test_pypi_password }} + password: ${{ secrets.pypi_password }} packages-dir: custom-dir/ ``` From 19c0fbd15c2848006c0e75f65c636838fcef7352 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 6 Dec 2019 13:44:40 +0100 Subject: [PATCH 4/4] Reword `package-dir` example title in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8250de5..e526126 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ The action invocation in this case would look like: repository_url: https://test.pypi.org/legacy/ ``` -## Target Directory +### Customizing target package dists directory You can change the default target directory of `dist/` to any directory of your liking. The action invocation