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
|
|
|
|
|
2021-06-23 04:08:02 -04:00
|
|
|
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/^*/ */' )"
|
2021-10-07 12:17:44 -04:00
|
|
|
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
|
2021-02-08 02:50:16 -05:00
|
|
|
sed -i "s,version = '${current_version}',version = '${new_version}'," api-daemon/pvcapid/Daemon.py
|
2021-06-23 04:08:02 -04:00
|
|
|
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
|
|
|
|
2021-10-07 12:04:55 -04:00
|
|
|
changelog_tmpdir=$( mktemp -d )
|
|
|
|
cp CHANGELOG.md ${changelog_tmpdir}/
|
|
|
|
pushd ${changelog_tmpdir} &>/dev/null
|
2020-11-08 01:57:11 -05:00
|
|
|
|
2021-10-07 12:17:44 -04: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
|
|
|
|
2021-10-07 12:04:55 -04: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
|
2021-10-07 12:04:55 -04:00
|
|
|
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
|
|
|
|
|
2021-10-07 12:04:55 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
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
|