From 6fd6f609238b836e2c0579581331fda8987ec371 Mon Sep 17 00:00:00 2001 From: Sergei Silnov Date: Thu, 19 Sep 2024 18:03:14 +0200 Subject: [PATCH] fix: Fix the deprecation message on every execution of the action --- README.md | 26 +++++++++++++------------- action.yml | 3 ++- upload.sh | 9 +++++++++ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ef4b4ee..ffb4953 100644 --- a/README.md +++ b/README.md @@ -100,16 +100,16 @@ jobs: ## Parameters -| Input | Optional | Default | Description | -|------------------------|----------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------| -| api_token | ❌ | | API Token for the component registry | -| namespace | ❌ | | Component namespace | -| name | ✔ / ❌ | | Name is required for uploading a component from the root of the repository | -| version | ✔ | | Version of the component, if not specified in the manifest. Should be a [semver](https://semver.org/) like `1.2.3` or `v1.2.3` | -| directories | ✔ | Repo root | Semicolon separated list of directories with components. | -| skip_pre_release | ✔ | False | Set this flag to `true`, `t`, `yes` or `1` to skip [pre-release](https://semver.org/#spec-item-9) versions. | -| dry_run | ✔ | False | Set this flag to `true`, `t`, `yes` or `1` to upload a component for validation only without creating a version in the registry. | -| service_url | ✔ | https://components.espressif.com/api | (Deprecated) IDF Component registry API URL | -| registry_url | ✔ | https://components.espressif.com/ | IDF Component registry URL | -| repository_url | ✔ | Current working repository | URL of the repository where component is located. Set to empty string if you don't want to send the information about the repository. | -| commit_sha | ✔ | Current commit sha | Git commit SHA of the the component version. Set to empty string if you don't want to send the information about the repository. | +| Input | Optional | Default | Description | +| ---------------- | -------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | +| api_token | ❌ | | API Token for the component registry | +| namespace | ❌ | | Component namespace | +| name | ✔ / ❌ | | Name is required for uploading a component from the root of the repository | +| version | ✔ | | Version of the component, if not specified in the manifest. Should be a [semver](https://semver.org/) like `1.2.3` or `v1.2.3` | +| directories | ✔ | Repo root | Semicolon separated list of directories with components. | +| skip_pre_release | ✔ | False | Set this flag to `true`, `t`, `yes` or `1` to skip [pre-release](https://semver.org/#spec-item-9) versions. | +| dry_run | ✔ | False | Set this flag to `true`, `t`, `yes` or `1` to upload a component for validation only without creating a version in the registry. | +| service_url | ✔ | https://components.espressif.com/api | (Deprecated, use "registry_url") IDF Component registry API URL | +| registry_url | ✔ | https://components.espressif.com/ | IDF Component registry URL | +| repository_url | ✔ | Current working repository | URL of the repository where component is located. Set to empty string if you don't want to send the information about the repository. | +| commit_sha | ✔ | Current commit sha | Git commit SHA of the the component version. Set to empty string if you don't want to send the information about the repository. | diff --git a/action.yml b/action.yml index a84f5fe..ca0f931 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,7 @@ inputs: required: false service_url: description: "Component registry API endpoint" + deprecationMessage: "Please use 'registry_url'." required: false registry_url: description: "Component registry endpoint" @@ -50,7 +51,7 @@ runs: COMPONENT_NAME: ${{ inputs.name }} COMPONENT_VERSION: ${{ inputs.version }} IDF_COMPONENT_API_TOKEN: ${{ inputs.api_token }} - DEFAULT_COMPONENT_SERVICE_URL: ${{ inputs.service_url }} + DEPRECATED_IDF_COMPONENT_REGISTRY_URL: ${{ inputs.service_url }} IDF_COMPONENT_REGISTRY_URL: ${{ inputs.registry_url }} SKIP_PRE_RELEASE: ${{ inputs.skip_pre_release }} DRY_RUN: ${{ inputs.dry_run }} diff --git a/upload.sh b/upload.sh index 5131142..d87c266 100755 --- a/upload.sh +++ b/upload.sh @@ -1,5 +1,14 @@ #!/bin/bash +# Handle registry URL +if [[ -n "$DEPRECATED_IDF_COMPONENT_REGISTRY_URL" ]]; then + if [[ -z "$IDF_COMPONENT_REGISTRY_URL" ]]; then + export IDF_COMPONENT_REGISTRY_URL="$DEPRECATED_IDF_COMPONENT_REGISTRY_URL" + else + echo "NOTICE: Both 'service_url' and 'registry_url' inputs are specified. 'registry_url' will be used as the final value." + fi +fi + IFS=';' read -ra DIRECTORIES <<<"$(echo -e "${COMPONENTS_DIRECTORIES:-.}" | tr -d '[:space:]')" NAMESPACE=${COMPONENTS_NAMESPACE:-espressif} UPLOAD_ARGUMENTS=("--allow-existing" "--namespace=${NAMESPACE}" )