feat: allow manual version overrides
This commit is contained in:
parent
f3ba8cbc3c
commit
b9ce80f179
2 changed files with 16 additions and 10 deletions
18
action.yaml
18
action.yaml
|
|
@ -1,16 +1,19 @@
|
|||
name: "check-latest-version-exists action"
|
||||
description: "Check whether the latest github release/tag of a pypi package exists on a registry. If not, return the latest version"
|
||||
description: "Check whether the latest GitHub release/tag of a PyPI package exists on a registry. If not, return the latest version."
|
||||
|
||||
inputs:
|
||||
github-repository:
|
||||
description: "The package's Github repository name (owner/repo)"
|
||||
required: true
|
||||
pypi-package:
|
||||
description: "The name of the package"
|
||||
required: true
|
||||
pypi-base-url:
|
||||
description: "The pypi registry URL"
|
||||
description: "The PyPI registry URL"
|
||||
required: true
|
||||
override-version:
|
||||
description: "Don't check GitHub for the latest version, use this one"
|
||||
required: false
|
||||
github-repository:
|
||||
description: "The package's GitHub repository name (owner/repo). Required if override-version is unset"
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
version:
|
||||
|
|
@ -27,6 +30,7 @@ runs:
|
|||
exec python3 $GITHUB_ACTION_PATH/check.py >> $GITHUB_OUTPUT
|
||||
env:
|
||||
REPOSITORY: ${{ inputs.github-repository }}
|
||||
PACKAGE: ${{ inputs.pypi-package}}
|
||||
BASE_URL: ${{ inputs.pypi-base-url}}
|
||||
PACKAGE: ${{ inputs.pypi-package }}
|
||||
BASE_URL: ${{ inputs.pypi-base-url }}
|
||||
VERSION: ${{ inputs.override-version }}
|
||||
|
||||
|
|
|
|||
6
check.py
6
check.py
|
|
@ -22,11 +22,13 @@ def does_pypi_version_exist(base_url: str, package: str, version: str) -> bool:
|
|||
|
||||
|
||||
def main():
|
||||
repository = os.environ["REPOSITORY"]
|
||||
package = os.environ["PACKAGE"]
|
||||
base_url = os.environ["BASE_URL"]
|
||||
|
||||
version = get_github_version(repository)
|
||||
version = os.environ.get(
|
||||
"VERSION",
|
||||
get_github_version(os.environ["REPOSITORY"])
|
||||
)
|
||||
|
||||
if does_pypi_version_exist(base_url, package, version):
|
||||
sys.exit(0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue