Allow to mark the published github release as latest (#135)

* Allow to mark the published github release as latest

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L
2023-03-24 11:56:51 +01:00
committed by GitHub
parent be16258da8
commit 31bbcdca8b
3 changed files with 20 additions and 0 deletions
+1
View File
@@ -20,6 +20,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
- `charts_dir`: The charts directory - `charts_dir`: The charts directory
- `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`) - `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
- `skip_packaging`: This option, when populated, will skip the packaging step. This allows you to do more advanced packaging of your charts (for example, with the `helm package` command) before this action runs. This action will only handle the indexing and publishing steps. - `skip_packaging`: This option, when populated, will skip the packaging step. This allows you to do more advanced packaging of your charts (for example, with the `helm package` command) before this action runs. This action will only handle the indexing and publishing steps.
- `mark_as_latest`: When you set this to `false`, it will mark the created GitHub release not as 'latest'.
### Environment variables ### Environment variables
+8
View File
@@ -25,6 +25,10 @@ inputs:
skip_packaging: skip_packaging:
description: "skip the packaging option (do your custom packaging before running this action" description: "skip the packaging option (do your custom packaging before running this action"
required: false required: false
mark_as_latest:
description: Mark the created GitHub release as 'latest'
required: false
default: true
runs: runs:
using: composite using: composite
@@ -61,5 +65,9 @@ runs:
args+=(--skip-packaging "${{ inputs.skip_packaging }}") args+=(--skip-packaging "${{ inputs.skip_packaging }}")
fi fi
if [[ -n "${{ inputs.mark_as_latest }}" ]]; then
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
fi
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}" "$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
shell: bash shell: bash
+11
View File
@@ -33,6 +33,7 @@ Usage: $(basename "$0") <options>
-n, --install-dir The Path to install the cr tool -n, --install-dir The Path to install the cr tool
-i, --install-only Just install the cr tool -i, --install-only Just install the cr tool
-s, --skip-packaging Skip the packaging step (run your own packaging before using the releaser) -s, --skip-packaging Skip the packaging step (run your own packaging before using the releaser)
-l, --mark-as-latest Mark the created GitHub release as 'latest' (default: true)
EOF EOF
} }
@@ -45,6 +46,7 @@ main() {
local install_dir= local install_dir=
local install_only= local install_only=
local skip_packaging= local skip_packaging=
local mark_as_latest=true
parse_command_line "$@" parse_command_line "$@"
@@ -171,6 +173,12 @@ parse_command_line() {
shift shift
fi fi
;; ;;
-l|--mark-as-latest)
if [[ -n "${2:-}" ]]; then
mark_as_latest="$2"
shift
fi
;;
*) *)
break break
;; ;;
@@ -272,6 +280,9 @@ release_charts() {
if [[ -n "$config" ]]; then if [[ -n "$config" ]]; then
args+=(--config "$config") args+=(--config "$config")
fi fi
if [[ "$mark_as_latest" = false ]]; then
args+=(--make-release-latest=false)
fi
echo 'Releasing charts...' echo 'Releasing charts...'
cr upload "${args[@]}" cr upload "${args[@]}"