diff --git a/action.yml b/action.yml index 01afdfd..89c0de4 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,7 @@ inputs: anaconda_nightly_upload_labels: description: 'Labels assigned to the uploaded artifacts' required: false - default: [main] + default: main runs: using: 'docker' diff --git a/cmd.sh b/cmd.sh index 4fab127..74e5118 100644 --- a/cmd.sh +++ b/cmd.sh @@ -33,6 +33,23 @@ if [ -z "${ANACONDA_TOKEN}" ]; then exit -1 fi +if [ -z ${ANACONDA_LABELS} ]; then + echo "ANACONDA_LABELS is empty , using default label (main)..." + ANACONDA_LABELS="--label main" +else + # Count the number of words in the string + label_count=$(echo "$ANACONDA_LABELS" | wc -w) + if [ "$label_count" -gt 1 ]; then + formatted_labels="" + for label in ${ANACONDA_LABELS}; do + formatted_labels+="--label ${label} " + done + ANACONDA_LABELS="${formatted_labels}" + else + ANACONDA_LABELS="--label ${ANACONDA_LABELS}" + fi +fi + # Install anaconda-client from lock file echo "Installing anaconda-client from upload-nightly-action conda-lock lock file..." micromamba create \ @@ -57,6 +74,6 @@ echo "Uploading wheels to anaconda.org..." anaconda --token "${ANACONDA_TOKEN}" upload \ --force \ --user "${ANACONDA_ORG}" \ - --label "${ANACONDA_LABELS}" \ + "${ANACONDA_LABELS}" \ "${INPUT_ARTIFACTS_PATH}"/*.whl echo "Index: https://pypi.anaconda.org/${ANACONDA_ORG}/simple"