patch: fix release file
This commit is contained in:
+6
-10
@@ -19,15 +19,11 @@ echo "$msg" | grep -Eqi '(^|[[:space:]])[a-zA-Z]+(\([^)]*\))?!:' && bump=major
|
||||
# Explicit bump prefixes still supported (but never downgrade a major bump)
|
||||
echo "$msg" | grep -qi minor: && [ "$bump" != "major" ] && bump=minor
|
||||
echo "$msg" | grep -qi major: && bump=major
|
||||
cur=$(cat VERSION | tr -d '\n')
|
||||
case "$cur" in
|
||||
[0-9]*.[0-9]*.[0-9]*) ;;
|
||||
*) echo "error: VERSION must be x.y.z (got: $cur)"; exit 1 ;;
|
||||
esac
|
||||
cur=$(awk '/"version"/ { match($0, /[0-9]+\.[0-9]+\.[0-9]+/); print substr($0, RSTART, RLENGTH); exit }' package.json)
|
||||
major=$(echo "$cur" | cut -d. -f1); minor=$(echo "$cur" | cut -d. -f2); patch=$(echo "$cur" | cut -d. -f3)
|
||||
case "$bump" in major) major=$((major+1)); minor=0; patch=0 ;; minor) minor=$((minor+1)); patch=0 ;; patch) patch=$((patch+1)) ;; esac
|
||||
newVersion="$major.$minor.$patch"
|
||||
[ -z "$cur" ] && { echo "error: could not read version from VERSION"; exit 1; }
|
||||
[ -z "$cur" ] && { echo "error: could not read version from package.json"; exit 1; }
|
||||
|
||||
# changelog entry (strip explicit bump prefixes & any conventional-commit type(scope):); optional PR description enriches it
|
||||
changelogEntry=$(
|
||||
@@ -46,9 +42,9 @@ else
|
||||
fi
|
||||
|
||||
# bump files
|
||||
echo "$newVersion" > VERSION
|
||||
awk -v v="$newVersion" '/^version:/ { $0 = "version: " v }; /^appVersion:/ { $0 = "appVersion: \"" v "\"" }; { print }' helm/jasper/Chart.yaml > helm/jasper/Chart.yaml.tmp && mv helm/jasper/Chart.yaml.tmp helm/jasper/Chart.yaml
|
||||
awk -v v="$newVersion" '/^ tag:/ { $0 = " tag: " v }; { print }' helm/jasper/values.yaml > helm/jasper/values.yaml.tmp && mv helm/jasper/values.yaml.tmp helm/jasper/values.yaml
|
||||
awk -v v="$newVersion" '/"version"/ { sub(/[0-9]+\.[0-9]+\.[0-9]+/, v) } { print }' package.json > package.json.tmp && mv package.json.tmp package.json
|
||||
awk -v v="$newVersion" '/^version:/ { $0 = "version: " v }; /^appVersion:/ { $0 = "appVersion: \"" v "\"" }; { print }' helm/kestrelos/Chart.yaml > helm/kestrelos/Chart.yaml.tmp && mv helm/kestrelos/Chart.yaml.tmp helm/kestrelos/Chart.yaml
|
||||
awk -v v="$newVersion" '/^ tag:/ { $0 = " tag: " v }; { print }' helm/kestrelos/values.yaml > helm/kestrelos/values.yaml.tmp && mv helm/kestrelos/values.yaml.tmp helm/kestrelos/values.yaml
|
||||
|
||||
# changelog
|
||||
new="## [$newVersion] - $(date +%Y-%m-%d)
|
||||
@@ -61,7 +57,7 @@ $changelogFull
|
||||
|
||||
# git
|
||||
git config user.email "ci@kestrelos" && git config user.name "CI"
|
||||
git add VERSION helm/jasper/Chart.yaml helm/jasper/values.yaml CHANGELOG.md
|
||||
git add package.json helm/kestrelos/Chart.yaml helm/kestrelos/values.yaml CHANGELOG.md
|
||||
git commit -m "release v$newVersion [skip ci]"
|
||||
url="https://${CI_REPO_OWNER}:${GITEA_REPO_TOKEN}@${CI_FORGE_URL#https://}/${CI_REPO_OWNER}/${CI_REPO_NAME}.git"
|
||||
git tag "v$newVersion"
|
||||
|
||||
Reference in New Issue
Block a user