Skip to content

Commit

Permalink
Allow to mark the published github release as latest (#135)
Browse files Browse the repository at this point in the history
* Allow to mark the published github release as latest

Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen authored Mar 24, 2023
1 parent be16258 commit 31bbcdc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 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.
- `mark_as_latest`: When you set this to `false`, it will mark the created GitHub release not as 'latest'.

### Environment variables

Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ inputs:
skip_packaging:
description: "skip the packaging option (do your custom packaging before running this action"
required: false
mark_as_latest:
description: Mark the created GitHub release as 'latest'
required: false
default: true

runs:
using: composite
Expand Down Expand Up @@ -61,5 +65,9 @@ runs:
args+=(--skip-packaging "${{ inputs.skip_packaging }}")
fi
if [[ -n "${{ inputs.mark_as_latest }}" ]]; then
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
fi
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
shell: bash
11 changes: 11 additions & 0 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)
-l, --mark-as-latest Mark the created GitHub release as 'latest' (default: true)
EOF
}

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

parse_command_line "$@"

Expand Down Expand Up @@ -171,6 +173,12 @@ parse_command_line() {
shift
fi
;;
-l|--mark-as-latest)
if [[ -n "${2:-}" ]]; then
mark_as_latest="$2"
shift
fi
;;
*)
break
;;
Expand Down Expand Up @@ -272,6 +280,9 @@ release_charts() {
if [[ -n "$config" ]]; then
args+=(--config "$config")
fi
if [[ "$mark_as_latest" = false ]]; then
args+=(--make-release-latest=false)
fi

echo 'Releasing charts...'
cr upload "${args[@]}"
Expand Down

0 comments on commit 31bbcdc

Please sign in to comment.