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"
|
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:
|
inputs:
|
||||||
github-repository:
|
|
||||||
description: "The package's Github repository name (owner/repo)"
|
|
||||||
required: true
|
|
||||||
pypi-package:
|
pypi-package:
|
||||||
description: "The name of the package"
|
description: "The name of the package"
|
||||||
required: true
|
required: true
|
||||||
pypi-base-url:
|
pypi-base-url:
|
||||||
description: "The pypi registry URL"
|
description: "The PyPI registry URL"
|
||||||
required: true
|
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:
|
outputs:
|
||||||
version:
|
version:
|
||||||
|
|
@ -27,6 +30,7 @@ runs:
|
||||||
exec python3 $GITHUB_ACTION_PATH/check.py >> $GITHUB_OUTPUT
|
exec python3 $GITHUB_ACTION_PATH/check.py >> $GITHUB_OUTPUT
|
||||||
env:
|
env:
|
||||||
REPOSITORY: ${{ inputs.github-repository }}
|
REPOSITORY: ${{ inputs.github-repository }}
|
||||||
PACKAGE: ${{ inputs.pypi-package}}
|
PACKAGE: ${{ inputs.pypi-package }}
|
||||||
BASE_URL: ${{ inputs.pypi-base-url}}
|
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():
|
def main():
|
||||||
repository = os.environ["REPOSITORY"]
|
|
||||||
package = os.environ["PACKAGE"]
|
package = os.environ["PACKAGE"]
|
||||||
base_url = os.environ["BASE_URL"]
|
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):
|
if does_pypi_version_exist(base_url, package, version):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue