From 004a976f5d9fde765b30c14deab8ca28be3c36b3 Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:35:00 +0200 Subject: [PATCH 1/7] Added: --packages-with-index parameter Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- README.md | 1 + action.yml | 7 +++++++ cr.sh | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 03ead65..92fe08b 100644 --- a/README.md +++ b/README.md @@ -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 - `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'. +- `packages_with_index`: When you set this to `false`, it will upload chart packages directly into publishing branch. ### Outputs diff --git a/action.yml b/action.yml index 0ae62cf..7627f48 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,9 @@ inputs: description: Mark the created GitHub release as 'latest' required: false default: true + packages_with_index: + description: "Upload chart packages directly into publishing branch" + required: false outputs: changed_charts: description: "A comma-separated list of charts that were released on this run. Will be an empty string if no updates were detected, will be unset if `--skip_packaging` is used: in the latter case your custom packaging step is responsible for setting its own outputs if you need them." @@ -84,6 +87,10 @@ runs: args+=(--mark-as-latest "${{ inputs.mark_as_latest }}") fi + if [[ -n "${{ inputs.packages_with_index }}" ]]; then + args+=(--packages-with-index "${{ inputs.packages_with_index }}") + fi + "$GITHUB_ACTION_PATH/cr.sh" "${args[@]}" if [[ -f changed_charts.txt ]]; then diff --git a/cr.sh b/cr.sh index 8fcfea3..4e9ae0a 100755 --- a/cr.sh +++ b/cr.sh @@ -194,6 +194,12 @@ parse_command_line() { shift fi ;; + --packages-with-index) + if [[ -n "${2:-}" ]]; then + packages_with_index="$2" + shift + fi + ;; *) break ;; From bcee58fbeb79d9add2b248fdf9c5a81f4c76b5b7 Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:41:08 +0200 Subject: [PATCH 2/7] Fixed: set to true instead of false in docs Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92fe08b..e8baf83 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi - `charts_dir`: The charts directory - `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'. -- `packages_with_index`: When you set this to `false`, it will upload chart packages directly into publishing branch. +- `packages_with_index`: When you set this to `true`, it will upload chart packages directly into publishing branch. ### Outputs From 1addc8f36bfde83a4e89ecdd10d978dda0fa3e49 Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:15:51 +0200 Subject: [PATCH 3/7] Fixed: args missing Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- cr.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cr.sh b/cr.sh index 4e9ae0a..a477f5e 100755 --- a/cr.sh +++ b/cr.sh @@ -302,7 +302,11 @@ release_charts() { args+=(--config "$config") fi if [[ -n "$skip_existing" ]]; then - args+=(--skip-existing) + if [[ -n "$packages_with_index" ]]; then + args+=(--packages-with-index --push --skip-existing) + elif [[ -n "$skip_existing" ]]; then + args+=(--skip-existing) + fi fi if [[ "$mark_as_latest" = false ]]; then args+=(--make-release-latest=false) @@ -317,6 +321,9 @@ update_index() { if [[ -n "$config" ]]; then args+=(--config "$config") fi + if [[ -n "$packages_with_index" ]]; then + args+=(--packages-with-index --index-path .) + fi echo 'Updating charts repo index...' cr index "${args[@]}" From 99c0c835cce8071152e64ddc9c696baf8af2b85b Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:16:45 +0200 Subject: [PATCH 4/7] Fixed: indentation Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- cr.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cr.sh b/cr.sh index a477f5e..3bb55b6 100755 --- a/cr.sh +++ b/cr.sh @@ -195,11 +195,11 @@ parse_command_line() { fi ;; --packages-with-index) - if [[ -n "${2:-}" ]]; then - packages_with_index="$2" - shift - fi - ;; + if [[ -n "${2:-}" ]]; then + packages_with_index="$2" + shift + fi + ;; *) break ;; From 5534b09b57d8821b226703ff4fb218ec008817ab Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:17:01 +0200 Subject: [PATCH 5/7] Fixed: indentation Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- cr.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cr.sh b/cr.sh index 3bb55b6..872cf48 100755 --- a/cr.sh +++ b/cr.sh @@ -196,8 +196,8 @@ parse_command_line() { ;; --packages-with-index) if [[ -n "${2:-}" ]]; then - packages_with_index="$2" - shift + packages_with_index="$2" + shift fi ;; *) From 4984371f1e3d566ae2f42cb9e0919bc8718db7d8 Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:28:49 +0200 Subject: [PATCH 6/7] Fixed: missing default local variable Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- cr.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cr.sh b/cr.sh index 872cf48..ea771d4 100755 --- a/cr.sh +++ b/cr.sh @@ -49,6 +49,7 @@ main() { local skip_packaging= local skip_existing= local mark_as_latest=true + local packages_with_index=false parse_command_line "$@" From 420293c3307140089d597df18b72a33248ba4e60 Mon Sep 17 00:00:00 2001 From: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:39:57 +0200 Subject: [PATCH 7/7] Fixed: skip existing check Signed-off-by: Valeriano Manassero <14011549+valeriano-manassero@users.noreply.github.com> --- cr.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cr.sh b/cr.sh index ea771d4..48804a9 100755 --- a/cr.sh +++ b/cr.sh @@ -302,12 +302,10 @@ release_charts() { if [[ -n "$config" ]]; then args+=(--config "$config") fi - if [[ -n "$skip_existing" ]]; then - if [[ -n "$packages_with_index" ]]; then - args+=(--packages-with-index --push --skip-existing) - elif [[ -n "$skip_existing" ]]; then - args+=(--skip-existing) - fi + if [[ -n "$packages_with_index" ]]; then + args+=(--packages-with-index --push --skip-existing) + elif [[ -n "$skip_existing" ]]; then + args+=(--skip-existing) fi if [[ "$mark_as_latest" = false ]]; then args+=(--make-release-latest=false)