Commit 48773fa7 authored by anarcat's avatar anarcat Committed by anarcat

add auto release script

parent 039f9668
#!/bin/sh -e
# simple prompt, copied from
prompt_yes_no() {
while true ; do
printf "$* [Y/n] "
read answer
if [ -z "$answer" ] ; then
return 0
case $answer in
return 0
return 1
echo "Please answer yes or no"
if [ $# -lt 1 -o "$version" = "-h" ]; then
cat <<EOF
not enough arguments
Usage: $0 <new_version> [ <old_version> ]
exit 1
cat <<EOF
Aegir release script
This script should only be used by the core dev team when doing an
official release. If you are not one of those people, you probably
shouldn't be running this.
This script is going to modify the configs and documentation to
release $version from release $old_version.
if [ -z "$old_version" ]; then
echo "warning: no old version specified, UPGRADE.txt will be partly updated"
cat <<EOF
The following operations will be done:
1. change the makefile to download tarball
2. change the INSTALL.txt to point to tagged
3. change the UPGRADE.txt to point to release tags
4. change the version
5. display the resulting diff
6. commit those changes to git
7. lay down the tag (prompting you for a changelog)
8. revert the commit
9. (optionally) push those changes
The operation can be aborted before step 6 and 9. Don't forget that as
long as changes are not pushed upstream, this can all be reverted (see
git-reset(1) and git-revert(1) ).
if ! prompt_yes_no "continue?" ; then
exit 1
git pull
echo changing makefile to download tarball
sed -i -e '/^projects\[hostmaster\]\[download\]\[type\]/s/=.*$/ = "get"/' \
-e '/^projects\[hostmaster\]\[download\]\[url\]/s#=.*$#= "'$version'.tgz"#' \
-e '/^projects\[hostmaster\]\[download\]\[branch\].*/s/\[branch\] *=.*$/[directory_name] = "hostmaster"/' aegir.make && git add aegir.make
echo changing INSTALL.txt to point to tagged
sed -i "/http:\/\/\/?p=provision.git;a=blob_plain;;hb=HEAD/s/HEAD/provision-$version/" docs/INSTALL.txt && git add docs/INSTALL.txt
echo changing UPGRADE.txt to point to release tags
sed -i -e "s/export AEGIR_VERSION=HEAD/export AEGIR_VERSION=$version/" docs/UPGRADE.txt
if ! [ -z "$old_version" ]; then
sed -i -e "/export OLD_DRUPAL_DIR=/s#hostmaster-.*#hostmaster-$old_version#" docs/UPGRADE.txt
git add docs/UPGRADE.txt
echo changing version
sed -i -e "s/AEGIR_VERSION=.*$/AEGIR_VERSION=\"$version\"/" && git add
echo resulting changes to be committed:
git diff --cached | cat
if prompt_yes_no "commit changes and tag release? (y/N) "; then
echo okay, committing...
echo 'aborting, leaving changes in git staging area'
echo 'use "git reset; git checkout ." to revert'
exit 1
commitmsg=`git commit -m"change version information for release $version, from $old_version"`
echo $commitmsg
commitid=`echo $commitmsg | sed 's/^\[[a-z]* \([a-z0-9]*\)\].*$/\1/'`
git tag -a provision-$version
echo reverting tree to HEAD versions
git revert $commitid
if prompt_yes_no "push tags and commits upstream? (y/N) "; then
# this makes sure we push the commit *and* the tag
git push --tags origin HEAD
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment