obos-fi/makerelease

107 lines
2.4 KiB
Text
Raw Normal View History

2015-08-20 11:14:56 -06:00
#!/bin/bash
2015-08-20 14:46:36 -06:00
prjname=archfi
version=$(date +"%Y.%m.%d.%H.%M.%S")
branch=$(git rev-parse --abbrev-ref HEAD)
2015-08-20 13:01:57 -06:00
ssh -T git@github.com
if [ ! "$?" = "1" ]; then
2015-08-20 13:59:18 -06:00
echo "No Github ssh key loaded exiting..."
exit 1
fi
scp matmoul@web.sourceforge.net:/home/frs/project/$prjname/README.txt /dev/null
2015-08-20 18:50:11 -06:00
if [ ! "$?" = "0" ]; then
2015-08-20 13:59:18 -06:00
echo "No Sourceforge ssh key loaded exiting..."
2015-08-20 13:01:57 -06:00
exit 1
fi
2015-08-20 11:44:59 -06:00
clear
read -p "Current branch is $branch. Continue ? (y/N)" choice
case "$choice" in
n|N|'' )
echo "cancel build !"
exit 1
;;
y|Y ) echo "Begin Build Release...";;
* )
echo "cancel build !"
exit 1
;;
esac
echo "Building version $version..."
echo ""
echo "Finalise archfi script..."
2015-08-20 11:55:24 -06:00
sed -i /apptitle=/c\apptitle=\""Arch Linux Fast Install (archfi) - Version: $version (GPLv3)"\" archfi
sed -i /baseurl=https://raw.githubusercontent.com/c\baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master archfi
2015-08-20 11:14:56 -06:00
2015-08-20 11:44:59 -06:00
echo "Make last commit..."
2015-08-20 13:23:11 -06:00
git commit -a -m "New Release : $version"
2015-08-20 11:14:56 -06:00
2015-08-20 13:24:15 -06:00
if [ ! "$branch" = "master" ]; then
2015-08-20 13:01:57 -06:00
echo "Merge branch $branch to master..."
git checkout master
git merge $branch
2015-08-21 15:09:24 -06:00
read -p "Delete branch $branch ? (y/N)" choice
2015-08-20 13:01:57 -06:00
case "$choice" in
2015-08-21 15:09:24 -06:00
y|Y )
2015-08-20 13:01:57 -06:00
git branch -D $branch
;;
esac
fi
2016-04-10 13:25:50 -06:00
read -p "Push release ? (Y/n)" choice
case "$choice" in
n|N ) exit 1;;
esac
git checkout master
echo "Push release..."
git push
2015-08-20 13:01:57 -06:00
read -p "Publish to server ? (Y/n)" choice
case "$choice" in
2016-04-10 13:25:50 -06:00
n|N ) exit 1;;
2015-08-20 13:01:57 -06:00
esac
2015-08-20 11:14:56 -06:00
2015-08-20 13:23:11 -06:00
echo "Create index.html..."
fle=$(cat archfi)
git checkout gh-pages
echo "$fle" > index.html
chmod 640 index.html
git commit -a -m "New Release : $version"
echo "Push index.html..."
git push
2016-04-10 13:43:03 -06:00
git checkout master
2015-08-20 11:14:56 -06:00
#Sourceforge :
2015-08-20 13:54:49 -06:00
targetpath=.build/$version
mkdir -p $targetpath
cp -R * $targetpath
echo "Finalise archfi script..."
2016-04-16 18:27:01 -06:00
sed -i "/baseurl=https:\/\/raw.githubusercontent.com\/MatMoul\/archfi/c\baseurl=http://downloads.sourceforge.net/project/archfi/release/$version" $targetpath/archfi
2015-08-20 13:54:49 -06:00
echo "Publish release..."
scp -r $targetpath matmoul@web.sourceforge.net:/home/frs/project/$prjname/release/
2015-08-20 11:14:56 -06:00
2015-08-20 13:59:18 -06:00
echo "Update redirect page..."
pubfile=.build/index.php
echo "<?php" > $pubfile
echo "header(\"Location: http://downloads.sourceforge.net/project/$prjname/release/$version/$prjname\");" >> $pubfile
echo "exit;" >> $pubfile
echo "?>" >> $pubfile
2015-08-20 18:50:11 -06:00
scp $pubfile matmoul@web.sourceforge.net:/home/project-web/$prjname/htdocs/$prjname/index.php
2015-08-20 11:14:56 -06:00
2015-08-20 13:54:49 -06:00
rm -R .build
2015-08-21 16:47:01 -06:00
if [ ! "$branch" = "master" ]; then
git checkout $branch
fi