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/^*/ */' )"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
readme_tmpdir=$( mktemp -d )
|
|
|
|
cp README.md ${readme_tmpdir}/
|
|
|
|
cp docs/index.md ${readme_tmpdir}/
|
|
|
|
pushd ${readme_tmpdir} &>/dev/null
|
|
|
|
|
2021-10-04 01:41:48 -04:00
|
|
|
echo -e "\n###### v${new_version}\n\n${changelog}" >> middle
|
2020-11-08 01:57:11 -05:00
|
|
|
|
|
|
|
csplit README.md "/## Changelog/1" &>/dev/null
|
|
|
|
cat xx00 middle xx01 > README.md
|
|
|
|
rm xx00 xx01
|
|
|
|
|
|
|
|
csplit index.md "/## Changelog/1" &>/dev/null
|
|
|
|
cat xx00 middle xx01 > index.md
|
|
|
|
rm xx00 xx01
|
|
|
|
|
|
|
|
popd &>/dev/null
|
|
|
|
mv ${readme_tmpdir}/README.md README.md
|
|
|
|
mv ${readme_tmpdir}/index.md docs/index.md
|
|
|
|
rm -r ${readme_tmpdir}
|
|
|
|
|
|
|
|
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-06-29 18:58:21 -04:00
|
|
|
git add node-daemon/pvcnoded/Daemon.py api-daemon/pvcapid/Daemon.py client-cli/setup.py README.md docs/index.md debian/changelog .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
|