Skip to content
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_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'.
- `match_tags`: The glob to use to filter Git tags, usually used with the `CR_RELEASE_NAME_TEMPLATE` environment variable (default: all tags)
- `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)

Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ inputs:
description: Mark the created GitHub release as 'latest'
required: false
default: true
match_tags:
description: "The glob to use to filter Git tags (default: all tags)"
required: false
packages_with_index:
description: "Upload chart packages directly into publishing branch"
required: false
Expand Down Expand Up @@ -112,6 +115,10 @@ runs:
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
fi

if [[ -n "${{ inputs.match_tags }}" ]]; then
args+=(--match-tags "${{ inputs.match_tags }}")
fi

if [[ -n "${{ inputs.packages_with_index }}" ]]; then
args+=(--packages-with-index "${{ inputs.packages_with_index }}")
fi
Expand Down
20 changes: 19 additions & 1 deletion cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Usage: $(basename "$0") <options>
--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)
-m, --match-tags The glob to use to filter Git tags (default: all tags)
--packages-with-index Upload chart packages directly into publishing branch
--use-arm Use ARM64 binary (default: false)
EOF
Expand All @@ -48,6 +49,7 @@ main() {
local charts_dir=charts
local owner=
local repo=
local match_tags=
local install_dir=
local install_only=
local skip_packaging=
Expand Down Expand Up @@ -179,6 +181,16 @@ parse_command_line() {
shift
fi
;;
-m|--match-tags)
if [[ -n "${2:-}" ]]; then
match_tags="$2"
shift
else
echo "ERROR: '--match-tags' cannot be empty." >&2
show_help
exit 1
fi
;;
-n | --install-dir)
if [[ -n "${2:-}" ]]; then
install_dir="$2"
Expand Down Expand Up @@ -285,7 +297,13 @@ install_chart_releaser() {
lookup_latest_tag() {
git fetch --tags >/dev/null 2>&1

if ! git describe --tags --abbrev=0 HEAD~ 2>/dev/null; then
args=("describe" "--tags" "--abbrev=0")
if [ -n "$match_tags" ]; then
args+=(--match="$match_tags")
fi
args+=(HEAD~)

if ! git "${args[@]}" 2> /dev/null; then
git rev-list --max-parents=0 --first-parent HEAD
fi
}
Expand Down