Merge branch 'maintenance/kebab-case-inputs' into unstable/v1
This patch normalizes the action inputs to be kebab-case while keeping the old snake_case fallbacks working.
This commit is contained in:
commit
7104b6e981
|
@ -91,7 +91,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
user: ${{ env.devpi-username }}
|
user: ${{ env.devpi-username }}
|
||||||
password: ${{ env.devpi-password }}
|
password: ${{ env.devpi-password }}
|
||||||
repository_url: >-
|
repository-url: >-
|
||||||
http://devpi:${{ env.devpi-port }}/${{ env.devpi-username }}/public/
|
http://devpi:${{ env.devpi-port }}/${{ env.devpi-username }}/public/
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
14
README.md
14
README.md
|
@ -99,7 +99,7 @@ project's specific needs.
|
||||||
For example, you could implement a parallel workflow that
|
For example, you could implement a parallel workflow that
|
||||||
pushes every commit to TestPyPI or your own index server,
|
pushes every commit to TestPyPI or your own index server,
|
||||||
like `devpi`. For this, you'd need to (1) specify a custom
|
like `devpi`. For this, you'd need to (1) specify a custom
|
||||||
`repository_url` value and (2) generate a unique version
|
`repository-url` value and (2) generate a unique version
|
||||||
number for each upload so that they'd not create a conflict.
|
number for each upload so that they'd not create a conflict.
|
||||||
The latter is possible if you use `setuptools_scm` package but
|
The latter is possible if you use `setuptools_scm` package but
|
||||||
you could also invent your own solution based on the distance
|
you could also invent your own solution based on the distance
|
||||||
|
@ -114,7 +114,7 @@ The action invocation in this case would look like:
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||||
repository_url: https://test.pypi.org/legacy/
|
repository-url: https://test.pypi.org/legacy/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Customizing target package dists directory
|
### Customizing target package dists directory
|
||||||
|
@ -128,7 +128,7 @@ would now look like:
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
packages_dir: custom-dir/
|
packages-dir: custom-dir/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Disabling metadata verification
|
### Disabling metadata verification
|
||||||
|
@ -139,7 +139,7 @@ check with:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
with:
|
with:
|
||||||
verify_metadata: false
|
verify-metadata: false
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tolerating release package file duplicates
|
### Tolerating release package file duplicates
|
||||||
|
@ -149,12 +149,12 @@ may hit race conditions. For example, when publishing from multiple CIs
|
||||||
or even having workflows with the same steps triggered within GitHub
|
or even having workflows with the same steps triggered within GitHub
|
||||||
Actions CI/CD for different events concerning the same high-level act.
|
Actions CI/CD for different events concerning the same high-level act.
|
||||||
|
|
||||||
To facilitate this use-case, you may use `skip_existing` (disabled by
|
To facilitate this use-case, you may use `skip-existing` (disabled by
|
||||||
default) setting as follows:
|
default) setting as follows:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
with:
|
with:
|
||||||
skip_existing: true
|
skip-existing: true
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Pro tip**: try to avoid enabling this setting where possible. If you
|
> **Pro tip**: try to avoid enabling this setting where possible. If you
|
||||||
|
@ -177,7 +177,7 @@ It will show SHA256, MD5, BLAKE2-256 values of files to be uploaded.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
with:
|
with:
|
||||||
print_hash: true
|
print-hash: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Specifying a different username
|
### Specifying a different username
|
||||||
|
|
65
action.yml
65
action.yml
|
@ -9,31 +9,76 @@ inputs:
|
||||||
password:
|
password:
|
||||||
description: Password for your PyPI user or an access token
|
description: Password for your PyPI user or an access token
|
||||||
required: true
|
required: true
|
||||||
repository_url:
|
repository-url: # Canonical alias for `repository_url`
|
||||||
description: The repository URL to use
|
description: The repository URL to use
|
||||||
required: false
|
required: false
|
||||||
packages_dir:
|
repository_url: # DEPRECATED ALIAS; TODO: Remove in v3+
|
||||||
|
description: >-
|
||||||
|
[DEPRECATED]
|
||||||
|
The repository URL to use
|
||||||
|
deprecationMessage: >-
|
||||||
|
The inputs have been normalized to use kebab-case.
|
||||||
|
Use `repository-url` instead.
|
||||||
|
required: false
|
||||||
|
packages-dir: # Canonical alias for `packages_dir`
|
||||||
description: The target directory for distribution
|
description: The target directory for distribution
|
||||||
required: false
|
required: false
|
||||||
default: dist
|
default: dist
|
||||||
verify_metadata:
|
packages_dir: # DEPRECATED ALIAS; TODO: Remove in v3+
|
||||||
|
description: >-
|
||||||
|
[DEPRECATED]
|
||||||
|
The target directory for distribution
|
||||||
|
deprecationMessage: >-
|
||||||
|
The inputs have been normalized to use kebab-case.
|
||||||
|
Use `packages-dir` instead.
|
||||||
|
required: false
|
||||||
|
default: dist
|
||||||
|
verify-metadata: # Canonical alias for `verify_metadata`
|
||||||
description: Check metadata before uploading
|
description: Check metadata before uploading
|
||||||
required: false
|
required: false
|
||||||
default: 'true'
|
default: 'true'
|
||||||
skip_existing:
|
verify_metadata: # DEPRECATED ALIAS; TODO: Remove in v3+
|
||||||
|
description: >-
|
||||||
|
[DEPRECATED]
|
||||||
|
Check metadata before uploading
|
||||||
|
deprecationMessage: >-
|
||||||
|
The inputs have been normalized to use kebab-case.
|
||||||
|
Use `verify-metadata` instead.
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
skip-existing: # Canonical alias for `skip_existing`
|
||||||
description: >-
|
description: >-
|
||||||
Do not fail if a Python package distribution
|
Do not fail if a Python package distribution
|
||||||
exists in the target package index
|
exists in the target package index
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
skip_existing: # DEPRECATED ALIAS; TODO: Remove in v3+
|
||||||
|
description: >-
|
||||||
|
[DEPRECATED]
|
||||||
|
Do not fail if a Python package distribution
|
||||||
|
exists in the target package index
|
||||||
|
deprecationMessage: >-
|
||||||
|
The inputs have been normalized to use kebab-case.
|
||||||
|
Use `skip-existing` instead.
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
verbose:
|
verbose:
|
||||||
description: Show verbose output.
|
description: Show verbose output.
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
print_hash:
|
print-hash: # Canonical alias for `print_hash`
|
||||||
description: Show hash values of files to be uploaded
|
description: Show hash values of files to be uploaded
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
print_hash: # DEPRECATED ALIAS; TODO: Remove in v3+
|
||||||
|
description: >-
|
||||||
|
[DEPRECATED]
|
||||||
|
Show hash values of files to be uploaded
|
||||||
|
deprecationMessage: >-
|
||||||
|
The inputs have been normalized to use kebab-case.
|
||||||
|
Use `print-hash` instead.
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
branding:
|
branding:
|
||||||
color: yellow
|
color: yellow
|
||||||
icon: upload-cloud
|
icon: upload-cloud
|
||||||
|
@ -43,9 +88,9 @@ runs:
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.user }}
|
- ${{ inputs.user }}
|
||||||
- ${{ inputs.password }}
|
- ${{ inputs.password }}
|
||||||
- ${{ inputs.repository_url }}
|
- ${{ inputs.repository-url }}
|
||||||
- ${{ inputs.packages_dir }}
|
- ${{ inputs.packages-dir }}
|
||||||
- ${{ inputs.verify_metadata }}
|
- ${{ inputs.verify-metadata }}
|
||||||
- ${{ inputs.skip_existing }}
|
- ${{ inputs.skip-existing }}
|
||||||
- ${{ inputs.verbose }}
|
- ${{ inputs.verbose }}
|
||||||
- ${{ inputs.print_hash }}
|
- ${{ inputs.print-hash }}
|
||||||
|
|
|
@ -18,6 +18,26 @@ export PATH="$(python -m site --user-base)/bin:${PATH}"
|
||||||
export PYTHONPATH="$(python -m site --user-site):${PYTHONPATH}"
|
export PYTHONPATH="$(python -m site --user-site):${PYTHONPATH}"
|
||||||
|
|
||||||
|
|
||||||
|
function get-normalized-input() {
|
||||||
|
local var_name=${1}
|
||||||
|
python -c \
|
||||||
|
'
|
||||||
|
from os import getenv
|
||||||
|
from sys import argv
|
||||||
|
envvar_name = f"INPUT_{argv[1].upper()}"
|
||||||
|
print(getenv(envvar_name, getenv(envvar_name.replace("-", "_"), "")), end="")
|
||||||
|
' \
|
||||||
|
"${var_name}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INPUT_REPOSITORY_URL="$(get-normalized-input 'repository-url')"
|
||||||
|
INPUT_PACKAGES_DIR="$(get-normalized-input 'packages-dir')"
|
||||||
|
INPUT_VERIFY_METADATA="$(get-normalized-input 'verify-metadata')"
|
||||||
|
INPUT_SKIP_EXISTING="$(get-normalized-input 'skip-existing')"
|
||||||
|
INPUT_PRINT_HASH="$(get-normalized-input 'print-hash')"
|
||||||
|
|
||||||
|
|
||||||
if [[
|
if [[
|
||||||
"$INPUT_USER" == "__token__" &&
|
"$INPUT_USER" == "__token__" &&
|
||||||
! "$INPUT_PASSWORD" =~ ^pypi-
|
! "$INPUT_PASSWORD" =~ ^pypi-
|
||||||
|
|
Loading…
Reference in New Issue