Skip to content

Commit

Permalink
add flag to skip updating helm chart repo index
Browse files Browse the repository at this point in the history
Signed-off-by: Ravi Singh <17711778+ravikrs@users.noreply.github.com>
  • Loading branch information
ravikrs committed Feb 12, 2023
1 parent be16258 commit 847088b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_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_update_index`: This option, when populated, will skip updating helm chart repo index.

### Environment variables

Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
skip_packaging:
description: "skip the packaging option (do your custom packaging before running this action"
required: false
skip_update_index:
description: "skip updating helm chart repo index"
required: false

runs:
using: composite
Expand Down Expand Up @@ -60,6 +63,10 @@ runs:
if [[ -n "${{ inputs.skip_packaging }}" ]]; then
args+=(--skip-packaging "${{ inputs.skip_packaging }}")
fi
if [[ -n "${{ inputs.skip_update_index }}" ]]; then
args+=(--skip-update-index "${{ inputs.skip_update_index }}")
fi
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
shell: bash
16 changes: 14 additions & 2 deletions cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Usage: $(basename "$0") <options>
-n, --install-dir The Path to 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)
-u, --skip-update-index Skip update index step
EOF
}

Expand All @@ -45,6 +46,7 @@ main() {
local install_dir=
local install_only=
local skip_packaging=
local skip_update_index=

parse_command_line "$@"

Expand Down Expand Up @@ -81,7 +83,9 @@ main() {
done

release_charts
update_index
if [ -z "$skip_update_index" ]; then
update_index
fi
else
echo "Nothing to do. No chart changes detected."
fi
Expand All @@ -90,7 +94,9 @@ main() {
rm -rf .cr-index
mkdir -p .cr-index
release_charts
update_index
if [ -z "$skip_update_index" ]; then
update_index
fi
fi

popd > /dev/null
Expand Down Expand Up @@ -171,6 +177,12 @@ parse_command_line() {
shift
fi
;;
-u|--skip-update-index)
if [[ -n "${2:-}" ]]; then
skip_update_index="$2"
shift
fi
;;
*)
break
;;
Expand Down

0 comments on commit 847088b

Please sign in to comment.