forked from lix-project/lix
scripts/release-notes: Avoid mutating variables
This commit is contained in:
parent
b1ea30f21d
commit
7c4ee5c813
|
@ -89,33 +89,35 @@ if [[ ! -n "${VERSION:-}" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# mutate/initialize:
|
# version_major_minor: MAJOR.MINOR
|
||||||
# VERSION: MAJOR.MINOR
|
# version_full: MAJOR.MINOR.PATCH
|
||||||
# FULL_VERSION: MAJOR.MINOR.PATCH
|
# IS_PATCH: true if this is a patch release; append instead of create
|
||||||
# IS_PATCH: true if this is a patch release; append instead of create
|
|
||||||
if grep -E '^[0-9]+\.[0-9]+$' <<< "$VERSION" >/dev/null; then
|
if grep -E '^[0-9]+\.[0-9]+$' <<< "$VERSION" >/dev/null; then
|
||||||
log 'is minor'
|
log 'is minor'
|
||||||
IS_PATCH=false
|
IS_PATCH=false
|
||||||
FULL_VERSION="$VERSION.0"
|
version_full="$VERSION.0"
|
||||||
|
version_major_minor="$VERSION"
|
||||||
elif grep -E '^[0-9]+\.[0-9]+\.0$' <<< "$VERSION" >/dev/null; then
|
elif grep -E '^[0-9]+\.[0-9]+\.0$' <<< "$VERSION" >/dev/null; then
|
||||||
log 'is minor (.0)'
|
log 'is minor (.0)'
|
||||||
IS_PATCH=false
|
IS_PATCH=false
|
||||||
FULL_VERSION="$VERSION"
|
version_full="$VERSION"
|
||||||
VERSION="$(echo "$VERSION" | sed -e 's/\.0$//')"
|
version_major_minor="$(echo "$VERSION" | sed -e 's/\.0$//')"
|
||||||
elif grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' <<< "$VERSION" >/dev/null; then
|
elif grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' <<< "$VERSION" >/dev/null; then
|
||||||
log 'is patch'
|
log 'is patch'
|
||||||
IS_PATCH=true
|
IS_PATCH=true
|
||||||
FULL_VERSION="$VERSION"
|
version_full="$VERSION"
|
||||||
VERSION="$(echo "$VERSION" | sed -e 's/\.[0-9]*$//')"
|
version_major_minor="$(echo "$VERSION" | sed -e 's/\.[0-9]*$//')"
|
||||||
else
|
else
|
||||||
die "VERSION must be MAJOR.MINOR[.PATCH], where each is a number, e.g. 2.20 or 2.20.1 (VERSION was set to $VERSION)"
|
die "VERSION must be MAJOR.MINOR[.PATCH], where each is a number, e.g. 2.20 or 2.20.1 (VERSION was set to $VERSION)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "VERSION=$VERSION"
|
unset VERSION
|
||||||
log "FULL_VERSION=$FULL_VERSION"
|
|
||||||
|
log "version_major_minor=$version_major_minor"
|
||||||
|
log "version_full=$version_full"
|
||||||
log "IS_PATCH=$IS_PATCH"
|
log "IS_PATCH=$IS_PATCH"
|
||||||
|
|
||||||
basename=rl-$VERSION.md
|
basename=rl-${version_major_minor}.md
|
||||||
file=doc/manual/src/release-notes/$basename
|
file=doc/manual/src/release-notes/$basename
|
||||||
|
|
||||||
if ! $IS_PATCH; then
|
if ! $IS_PATCH; then
|
||||||
|
@ -142,9 +144,9 @@ esac
|
||||||
# --- DO THE WORK ---
|
# --- DO THE WORK ---
|
||||||
|
|
||||||
# menu
|
# menu
|
||||||
title="Release $VERSION ($DATE)"
|
title="Release $version_major_minor ($DATE)"
|
||||||
# section on page
|
# section on page
|
||||||
section_title="Release $FULL_VERSION ($DATE)"
|
section_title="Release $version_full ($DATE)"
|
||||||
|
|
||||||
(
|
(
|
||||||
# TODO add minor number, and append?
|
# TODO add minor number, and append?
|
||||||
|
@ -172,6 +174,6 @@ done
|
||||||
|
|
||||||
logcmd git add $file doc/manual/src/SUMMARY.md.in
|
logcmd git add $file doc/manual/src/SUMMARY.md.in
|
||||||
logcmd git status
|
logcmd git status
|
||||||
logcmd git commit -m "release notes: $VERSION"
|
logcmd git commit -m "release notes: $version_full"
|
||||||
|
|
||||||
report_done
|
report_done
|
||||||
|
|
Loading…
Reference in a new issue