diff --git a/README.md b/README.md index 567210a..5d76abf 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ The following examples use static files located within `test/fixtures`. When rep To pin to a specific release of this Github Action, replace `use: cloudsmith-io/action@master` with the version you require e.g. `uses: cloudsmith-io/action@0.4.0`. +You can also add "tags" to your upload process by specifying `tags` in your workflow, this is a comma separated string. (Some special characters like `:` are not allowed). + ### Alpine Package Push ```yaml @@ -74,6 +76,7 @@ jobs: release: "v3.9" republish: "true" # needed ONLY if version is not changing file: "test/fixture/cloudsmith-alpine-example-1.0.0-r0.apk" + tags: "tag1, tag2, tag3" ``` ### Cargo Crate Push @@ -120,6 +123,7 @@ jobs: repo: "actions" republish: "true" # needed ONLY if version is not changing file: "test/fixture/cloudsmith-composer-package-archive-0.1.0.zip" + tags: "tag1, tag2, tag3" ``` diff --git a/action.yml b/action.yml index 4ef035d..3ae5c16 100644 --- a/action.yml +++ b/action.yml @@ -94,6 +94,10 @@ inputs: description: "Nuget: Relevant Symbols file for the nuget package." required: false default: none + tags: + description: "The tags for the package, comma seperated" + required: false + default: none runs: using: "composite" steps: @@ -125,6 +129,7 @@ runs: -N ${{ inputs.symbols-file }} \ -S ${{ inputs.scope }} \ -s "${{ inputs.summary }}" \ + -t "${{ inputs.tags }}" \ -D "${{ inputs.description }}" \ -V ${{ inputs.version }} \ -p ${{ inputs.pom-file }} \ diff --git a/entrypoint.sh b/entrypoint.sh index b930981..e87c902 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,11 +42,12 @@ function setup_options { options["pom_file"]=$DEFAULT options["symbols_file"]=$DEFAULT options["extra"]=$DEFAULT + options["tags"]=$DEFAULT local raw_opts="$@" local OPTIND OPT - while getopts ":k:K:f:o:r:F:P:w:W:d:R:n:N:S:s:D:V:p:" OPT; do + while getopts ":k:K:f:o:r:F:P:w:W:d:R:n:N:S:s:t:D:V:p:" OPT; do case $OPT in k) options["api_key"]="$OPTARG" ;; K) options["command"]="$OPTARG" ;; @@ -63,6 +64,7 @@ function setup_options { N) options["symbols_file"]="$OPTARG" ;; S) options["scope"]="$OPTARG" ;; s) options["summary"]="$OPTARG" ;; + t) options["tags"]="$OPTARG" ;; D) options["description"]="$OPTARG" ;; V) options["version"]="$OPTARG" ;; p) options["pom_file"]="$OPTARG" ;; @@ -180,12 +182,16 @@ function execute_push { export CLOUDSMITH_API_KEY="${options["api_key"]}" } + check_option_set "${options["tags"]}" && { + params+=" --tags='${options["tags"]}'" + } + local extra="" check_option_set "${options["extra"]}" && { extra="${options["extra"]}" } - local request="cloudsmith push ${options["action"]} ${options["format"]} $context ${options["file"]} $params $extra" + local request="cloudsmith push ${options["action"]} ${options["format"]} $context ${options["file"]} $params $extra $tags" echo $request eval $request }