Skip to content

Commit 6203d70

Browse files
authored
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>
1 parent a917fd1 commit 6203d70

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
2020
- `charts_dir`: The charts directory
2121
- `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.
2222
- `skip_existing`: Skip package upload if release/tag already exists
23+
- `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`.
2324
- `mark_as_latest`: When you set this to `false`, it will mark the created GitHub release not as 'latest'.
2425
- `packages_with_index`: When you set this to `true`, it will upload chart packages directly into publishing branch.
2526
- `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)

action.yml

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ inputs:
4242
skip_existing:
4343
description: "Skip package upload if release exists"
4444
required: false
45+
skip_upload:
46+
description: "Skip package upload"
47+
required: false
4548
mark_as_latest:
4649
description: Mark the created GitHub release as 'latest'
4750
required: false
@@ -101,6 +104,10 @@ runs:
101104
args+=(--skip-existing "${{ inputs.skip_existing }}")
102105
fi
103106
107+
if [[ -n "${{ inputs.skip_upload }}" ]]; then
108+
args+=(--skip-upload "${{ inputs.skip_upload }}")
109+
fi
110+
104111
if [[ -n "${{ inputs.mark_as_latest }}" ]]; then
105112
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
106113
fi

cr.sh

+13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Usage: $(basename "$0") <options>
3535
-i, --install-only Just install the cr tool
3636
-s, --skip-packaging Skip the packaging step (run your own packaging before using the releaser)
3737
--skip-existing Skip package upload if release exists
38+
--skip-upload Skip package upload, just create the release. Not needed in case of OCI upload.
3839
-l, --mark-as-latest Mark the created GitHub release as 'latest' (default: true)
3940
--packages-with-index Upload chart packages directly into publishing branch
4041
EOF
@@ -50,6 +51,7 @@ main() {
5051
local install_only=
5152
local skip_packaging=
5253
local skip_existing=
54+
local skip_upload=
5355
local mark_as_latest=true
5456
local packages_with_index=false
5557
local pages_branch=
@@ -198,6 +200,12 @@ parse_command_line() {
198200
shift
199201
fi
200202
;;
203+
--skip-upload)
204+
if [[ -n "${2:-}" ]]; then
205+
skip_upload="$2"
206+
shift
207+
fi
208+
;;
201209
-l | --mark-as-latest)
202210
if [[ -n "${2:-}" ]]; then
203211
mark_as_latest="$2"
@@ -328,6 +336,11 @@ release_charts() {
328336
}
329337

330338
update_index() {
339+
if [[ -n "$skip_upload" ]]; then
340+
echo "Skipping index upload..."
341+
return
342+
fi
343+
331344
local args=(-o "$owner" -r "$repo" --push)
332345
if [[ -n "$config" ]]; then
333346
args+=(--config "$config")

0 commit comments

Comments
 (0)