Add --pages-branch parameter (#156)

Ref:
  helm/chart-releaser@378f527
  helm/chart-releaser@cb0563b

Signed-off-by: Michal Biesek <michalbiesek@gmail.com>
This commit is contained in:
michalbiesek
2023-09-05 09:10:00 +02:00
committed by GitHub
parent 5b8970c96f
commit ed43eb3036
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
- `skip_existing`: Skip package upload if release/tag already exists - `skip_existing`: Skip package upload if release/tag already exists
- `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)
### Outputs ### Outputs
+7
View File
@@ -35,6 +35,9 @@ inputs:
packages_with_index: packages_with_index:
description: "Upload chart packages directly into publishing branch" description: "Upload chart packages directly into publishing branch"
required: false required: false
pages_branch:
description: "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)"
required: false
outputs: outputs:
changed_charts: 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." 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."
@@ -91,6 +94,10 @@ runs:
args+=(--packages-with-index "${{ inputs.packages_with_index }}") args+=(--packages-with-index "${{ inputs.packages_with_index }}")
fi fi
if [[ -n "${{ inputs.pages_branch }}" ]]; then
args+=(--pages-branch "${{ inputs.pages_branch }}")
fi
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}" "$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
if [[ -f changed_charts.txt ]]; then if [[ -f changed_charts.txt ]]; then
+14
View File
@@ -30,6 +30,7 @@ Usage: $(basename "$0") <options>
-d, --charts-dir The charts directory (default: charts) -d, --charts-dir The charts directory (default: charts)
-o, --owner The repo owner -o, --owner The repo owner
-r, --repo The repo name -r, --repo The repo name
--pages-branch The repo pages branch
-n, --install-dir The Path to install the cr tool -n, --install-dir The Path to install the cr tool
-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)
@@ -51,6 +52,7 @@ main() {
local skip_existing= local skip_existing=
local mark_as_latest=true local mark_as_latest=true
local packages_with_index=false local packages_with_index=false
local pages_branch=
parse_command_line "$@" parse_command_line "$@"
@@ -166,6 +168,12 @@ parse_command_line() {
exit 1 exit 1
fi fi
;; ;;
--pages-branch)
if [[ -n "${2:-}" ]]; then
pages_branch="$2"
shift
fi
;;
-n | --install-dir) -n | --install-dir)
if [[ -n "${2:-}" ]]; then if [[ -n "${2:-}" ]]; then
install_dir="$2" install_dir="$2"
@@ -311,6 +319,9 @@ release_charts() {
if [[ "$mark_as_latest" = false ]]; then if [[ "$mark_as_latest" = false ]]; then
args+=(--make-release-latest=false) args+=(--make-release-latest=false)
fi fi
if [[ -n "$pages_branch" ]]; then
args+=(--pages-branch "$pages_branch")
fi
echo 'Releasing charts...' echo 'Releasing charts...'
cr upload "${args[@]}" cr upload "${args[@]}"
@@ -324,6 +335,9 @@ update_index() {
if [[ -n "$packages_with_index" ]]; then if [[ -n "$packages_with_index" ]]; then
args+=(--packages-with-index --index-path .) args+=(--packages-with-index --index-path .)
fi fi
if [[ -n "$pages_branch" ]]; then
args+=(--pages-branch "$pages_branch")
fi
echo 'Updating charts repo index...' echo 'Updating charts repo index...'
cr index "${args[@]}" cr index "${args[@]}"