Add --skip-upload input with latest helm/chart-releaser-action (#143)

* feat: add option --skip-upload, to not handle index.yaml for OCI charts

Signed-off-by: acuD1 <arsciand@student.42.fr>

* docs: update README.md for --skip-upload

Signed-off-by: acuD1 <arsciand@student.42.fr>

---------

Signed-off-by: acuD1 <arsciand@student.42.fr>
This commit is contained in:
Arthur S
2023-11-20 12:59:41 +01:00
committed by GitHub
parent a917fd15b2
commit 6203d709ca
3 changed files with 21 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
- `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.
- `skip_existing`: Skip package upload if release/tag already exists - `skip_existing`: Skip package upload if release/tag already exists
- `skip_upload`: This option, when populated, will skip the upload step. This allows you to do more advanced uploading of your charts (for exemple with OCI based repositories) which doen't require the `index.yaml`.
- `mark_as_latest`: When you set this to `false`, it will mark the created GitHub release not as 'latest'. - `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 `true`, 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.
- `pages_branch`: Name of the branch to be used to push the index and artifacts. (default to: gh-pages but it is not set in the action it is a default value for the chart-releaser binary) - `pages_branch`: Name of the branch to be used to push the index and artifacts. (default to: gh-pages but it is not set in the action it is a default value for the chart-releaser binary)
+7
View File
@@ -42,6 +42,9 @@ inputs:
skip_existing: skip_existing:
description: "Skip package upload if release exists" description: "Skip package upload if release exists"
required: false required: false
skip_upload:
description: "Skip package upload"
required: false
mark_as_latest: mark_as_latest:
description: Mark the created GitHub release as 'latest' description: Mark the created GitHub release as 'latest'
required: false required: false
@@ -101,6 +104,10 @@ runs:
args+=(--skip-existing "${{ inputs.skip_existing }}") args+=(--skip-existing "${{ inputs.skip_existing }}")
fi fi
if [[ -n "${{ inputs.skip_upload }}" ]]; then
args+=(--skip-upload "${{ inputs.skip_upload }}")
fi
if [[ -n "${{ inputs.mark_as_latest }}" ]]; then if [[ -n "${{ inputs.mark_as_latest }}" ]]; then
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}") args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
fi fi
+13
View File
@@ -35,6 +35,7 @@ Usage: $(basename "$0") <options>
-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)
--skip-existing Skip package upload if release exists --skip-existing Skip package upload if release exists
--skip-upload Skip package upload, just create the release. Not needed in case of OCI upload.
-l, --mark-as-latest Mark the created GitHub release as 'latest' (default: true) -l, --mark-as-latest Mark the created GitHub release as 'latest' (default: true)
--packages-with-index Upload chart packages directly into publishing branch --packages-with-index Upload chart packages directly into publishing branch
EOF EOF
@@ -50,6 +51,7 @@ main() {
local install_only= local install_only=
local skip_packaging= local skip_packaging=
local skip_existing= local skip_existing=
local skip_upload=
local mark_as_latest=true local mark_as_latest=true
local packages_with_index=false local packages_with_index=false
local pages_branch= local pages_branch=
@@ -198,6 +200,12 @@ parse_command_line() {
shift shift
fi fi
;; ;;
--skip-upload)
if [[ -n "${2:-}" ]]; then
skip_upload="$2"
shift
fi
;;
-l | --mark-as-latest) -l | --mark-as-latest)
if [[ -n "${2:-}" ]]; then if [[ -n "${2:-}" ]]; then
mark_as_latest="$2" mark_as_latest="$2"
@@ -328,6 +336,11 @@ release_charts() {
} }
update_index() { update_index() {
if [[ -n "$skip_upload" ]]; then
echo "Skipping index upload..."
return
fi
local args=(-o "$owner" -r "$repo" --push) local args=(-o "$owner" -r "$repo" --push)
if [[ -n "$config" ]]; then if [[ -n "$config" ]]; then
args+=(--config "$config") args+=(--config "$config")