Skip to content
Snippets Groups Projects
Commit 2eb593f4 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/semrel-integration' into 'master'

fix(semrel): preserve snapshot package even with semrel enabled and no next version required

See merge request to-be-continuous/helm!64
parents 47fc0d5a af44b019
No related branches found
No related tags found
No related merge requests found
......@@ -575,20 +575,19 @@ stages:
function helm_package() {
rm -f helm-package.env
# determine chart version to publish (semantic-release integration)
if [[ "${SEMREL_INFO_ON}" && "${HELM_SEMREL_RELEASE_DISABLED}" != "true" ]]
# extract version from chart
base_version=$(awk -F':' '/^version:/ {print $2}' "$HELM_CHART_DIR/Chart.yaml")
base_version=${base_version// /}
# override version if semantic-release integration is enabled
if [[ "${SEMREL_INFO_ON}" ]] && [[ "${HELM_SEMREL_RELEASE_DISABLED}" != "true" ]]
then
if [[ -z "${SEMREL_INFO_NEXT_VERSION}" ]]
then
log_warn "[semantic-release] no new version to release: skip"
exit 0
log_info "[semantic-release] no new version to release: use default"
else
log_info "[semantic-release] use computed next version: \\e[33;1m${SEMREL_INFO_NEXT_VERSION}\\e[0m"
base_version="${SEMREL_INFO_NEXT_VERSION}"
log_info "[semantic-release] use computed next version: \\e[33;1m${base_version}\\e[0m"
fi
else
base_version=$(awk -F':' '/^version:/ {print $2}' "$HELM_CHART_DIR/Chart.yaml")
base_version=${base_version// /}
fi
chart_name=$(awk -F':' '/^name:/ {print $2}' "$HELM_CHART_DIR/Chart.yaml")
chart_name=${chart_name// /}
......@@ -603,8 +602,6 @@ stages:
version_label="-$CI_COMMIT_REF_SLUG"
fi
add_helm_repositories
# helm package
log_info "packaging chart with version: \\e[33;1m${base_version}${version_label}\\e[0m"
# shellcheck disable=SC2086
......@@ -888,6 +885,13 @@ helm-publish:
extends: .helm-base
stage: publish
script:
# skip if semantic-release integration enabled and no release is required
- |
if [[ "${SEMREL_INFO_ON}" ]] && [[ "${HELM_SEMREL_RELEASE_DISABLED}" != "true" ]] && [[ -z "${SEMREL_INFO_NEXT_VERSION}" ]]
then
log_warn "[semantic-release] no new version to release: skip"
exit 0
fi
- helm_publish $helm_package_file
rules:
- if: '$HELM_PUBLISH_URL == null || $HELM_PUBLISH_URL == "" || $HELM_PUBLISH_METHOD == "disabled"'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment