Skip to content

Commit

Permalink
Merge pull request #19 from espressif/fix/dep-warning
Browse files Browse the repository at this point in the history
fix: Fix the deprecation message on every execution of the action
  • Loading branch information
kumekay committed Sep 20, 2024
2 parents 40cb0e9 + 6fd6f60 commit 4fe3261
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 }}
Expand Down
9 changes: 9 additions & 0 deletions upload.sh
Original file line number Diff line number Diff line change
@@ -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}" )
Expand Down

0 comments on commit 4fe3261

Please sign in to comment.