pvc/bump-version

61 lines
1.9 KiB
Plaintext
Raw Normal View History

2020-11-08 01:57:11 -05:00
#!/usr/bin/env bash
set -o errexit
new_version="${1}"
if [[ -z ${new_version} ]]; then
exit 1
fi
pushd $( git rev-parse --show-toplevel ) &>/dev/null
current_version="$( cat .version )"
2020-11-08 01:57:11 -05:00
echo "${current_version} -> ${new_version}"
changelog_file=$( mktemp )
echo "# Write the changelog below; comments will be ignored" >> ${changelog_file}
$EDITOR ${changelog_file}
changelog="$( cat ${changelog_file} | grep -v '^#' | sed 's/^*/ */' )"
rm ${changelog_file}
2020-11-08 01:57:11 -05:00
sed -i "s,version = '${current_version}',version = '${new_version}'," node-daemon/pvcnoded/Daemon.py
sed -i "s,version = '${current_version}',version = '${new_version}'," api-daemon/pvcapid/Daemon.py
sed -i "s,version='${current_version}',version='${new_version}'," client-cli/setup.py
echo ${new_version} > .version
2020-11-08 01:57:11 -05:00
changelog_tmpdir=$( mktemp -d )
cp CHANGELOG.md ${changelog_tmpdir}/
pushd ${changelog_tmpdir} &>/dev/null
2020-11-08 01:57:11 -05:00
echo -e "\n###### [v${new_version}](https://github.com/parallelvirtualcluster/pvc/releases/tag/v${new_version})\n\n${changelog}" >> middle
2020-11-08 01:57:11 -05:00
csplit CHANGELOG.md "/## PVC Changelog/1" &>/dev/null
cat xx00 middle xx01 > CHANGELOG.md
2020-11-08 01:57:11 -05:00
rm xx00 xx01
popd &>/dev/null
mv ${changelog_tmpdir}/CHANGELOG.md CHANGELOG.md
rm -r ${changelog_tmpdir}
2020-11-08 01:57:11 -05:00
deb_changelog_orig="$( cat debian/changelog )"
2020-11-08 02:16:36 -05:00
deb_changelog_new="pvc (${new_version}-0) unstable; urgency=high\n\n${changelog}\n\n -- $( git config --get user.name ) <$( git config --get user.email )> $( date --rfc-email )\n"
2020-11-08 01:57:11 -05:00
deb_changelog_file=$( mktemp )
echo -e "${deb_changelog_new}" >> ${deb_changelog_file}
echo -e "${deb_changelog_orig}" >> ${deb_changelog_file}
mv ${deb_changelog_file} debian/changelog
git add node-daemon/pvcnoded/Daemon.py api-daemon/pvcapid/Daemon.py client-cli/setup.py debian/changelog CHANGELOG.md .version
2020-11-08 01:57:11 -05:00
git commit -v
popd &>/dev/null
2020-11-08 01:57:11 -05:00
echo
echo "GitLab release message:"
echo
2020-11-08 02:05:59 -05:00
echo "# Parallel Virtual Cluster version ${new_version}"
2020-11-08 01:57:11 -05:00
echo
echo -e "${changelog}" | sed 's/^ \*/*/'
echo