Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to skip updating helm chart repo index #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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