diff --git a/src/jobs/checkout_and_version.yml b/src/jobs/checkout_and_version.yml index 9cf92d7..d238ec5 100644 --- a/src/jobs/checkout_and_version.yml +++ b/src/jobs/checkout_and_version.yml @@ -40,6 +40,14 @@ steps: name: Set version command: /bin/git-version --dev-branch "<>" --release-branch "<>" --version-prefix "<>" > .version + - run: + name: Sanitize version + # git-version emits -..sha. on non-release branches. + # If the short sha happens to be all-numeric with a leading zero (e.g. sha.0238954244), + # it is an invalid SemVer prerelease identifier and helm rejects the chart version. + # Prefix such shas with "g" (git-describe convention) to keep the identifier alphanumeric. + command: sed -E -i 's/\.sha\.(0[0-9]+)$/.sha.g\1/' .version + - run: name: Current version command: cat .version