Add config option (#50)
This commit is contained in:
@@ -16,6 +16,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
|
|||||||
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
|
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
|
||||||
|
|
||||||
- `version`: The chart-releaser version to use (default: v1.0.0)
|
- `version`: The chart-releaser version to use (default: v1.0.0)
|
||||||
|
- `config`: Optional config file for chart-releaser
|
||||||
- `charts_dir`: The charts directory
|
- `charts_dir`: The charts directory
|
||||||
- `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
|
- `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Usage: $(basename "$0") <options>
|
|||||||
|
|
||||||
-h, --help Display help
|
-h, --help Display help
|
||||||
-v, --version The chart-releaser version to use (default: $DEFAULT_CHART_RELEASER_VERSION)"
|
-v, --version The chart-releaser version to use (default: $DEFAULT_CHART_RELEASER_VERSION)"
|
||||||
|
--config The path to the chart-releaser config file
|
||||||
-d, --charts-dir The charts directory (default: charts)
|
-d, --charts-dir The charts directory (default: charts)
|
||||||
-u, --charts-repo-url The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)
|
-u, --charts-repo-url The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)
|
||||||
-o, --owner The repo owner
|
-o, --owner The repo owner
|
||||||
@@ -35,6 +36,7 @@ EOF
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
local version="$DEFAULT_CHART_RELEASER_VERSION"
|
local version="$DEFAULT_CHART_RELEASER_VERSION"
|
||||||
|
local config=
|
||||||
local charts_dir=charts
|
local charts_dir=charts
|
||||||
local owner=
|
local owner=
|
||||||
local repo=
|
local repo=
|
||||||
@@ -89,6 +91,16 @@ parse_command_line() {
|
|||||||
show_help
|
show_help
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
--config)
|
||||||
|
if [[ -n "${2:-}" ]]; then
|
||||||
|
config="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "ERROR: '--config' cannot be empty." >&2
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
-v|--version)
|
-v|--version)
|
||||||
if [[ -n "${2:-}" ]]; then
|
if [[ -n "${2:-}" ]]; then
|
||||||
version="$2"
|
version="$2"
|
||||||
@@ -207,18 +219,33 @@ lookup_changed_charts() {
|
|||||||
package_chart() {
|
package_chart() {
|
||||||
local chart="$1"
|
local chart="$1"
|
||||||
|
|
||||||
|
local args=(--package-path .cr-release-packages)
|
||||||
|
if [[ -n "$config" ]]; then
|
||||||
|
args+=(--config "$config")
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Packaging chart '$chart'..."
|
echo "Packaging chart '$chart'..."
|
||||||
cr package --package-path .cr-release-packages
|
cr package "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
release_charts() {
|
release_charts() {
|
||||||
|
local args=(-o "$owner" -r "$repo" -c "$(git rev-parse HEAD)")
|
||||||
|
if [[ -n "$config" ]]; then
|
||||||
|
args+=(--config "$config")
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'Releasing charts...'
|
echo 'Releasing charts...'
|
||||||
cr upload -o "$owner" -r "$repo" -c "$(git rev-parse HEAD)"
|
cr upload "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_index() {
|
update_index() {
|
||||||
|
local args=(-o "$owner" -r "$repo" -c "$charts_repo_url" --push)
|
||||||
|
if [[ -n "$config" ]]; then
|
||||||
|
args+=(--config "$config")
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'Updating charts repo index...'
|
echo 'Updating charts repo index...'
|
||||||
cr index -o "$owner" -r "$repo" -c "$charts_repo_url" --push
|
cr index "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ main() {
|
|||||||
args+=(--version "${INPUT_VERSION}")
|
args+=(--version "${INPUT_VERSION}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${INPUT_CONFIG:-}" ]]; then
|
||||||
|
args+=(--config "${INPUT_CONFIG}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${INPUT_CHARTS_REPO_URL:-}" ]]; then
|
if [[ -n "${INPUT_CHARTS_REPO_URL:-}" ]]; then
|
||||||
args+=(--charts-repo-url "${INPUT_CHARTS_REPO_URL}")
|
args+=(--charts-repo-url "${INPUT_CHARTS_REPO_URL}")
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user