aboutsummaryrefslogtreecommitdiffstats
path: root/makerelease
blob: 5487765d9b5472d08b9fe2b032b2e7aedd0ff2ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash

ssh -T git@github.com
if [ ! "$?" = "1" ]; then
  echo "No ssh key loaded exiting..."
  exit 1
fi


prjname=archfi
version=$(date +"%Y.%m.%d.%H.%M.%S")
branch=$(git rev-parse --abbrev-ref HEAD)

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..."
sed -i /apptitle=/c\apptitle=\""Arch Linux Fast Install (archfi) - Version: $version (GPLv3)"\" archfi
sed -i /baseurl=/c\baseurl=https://raw.githubusercontent.com/MatMoul/archfi/master archfi

echo "Finalise CHANGELOG..."
sed -i '/Current\ Version\ :/{n;d}' CHANGELOG
sed -i '/Current\ Version\ :/a-------------------------------' CHANGELOG
sed -i "/Current\ Version\ :/c\Version\ :\ $version\ :" CHANGELOG
sed -i '1s/^/\n/' CHANGELOG
sed -i '1s/^/-----------------\n/' CHANGELOG
sed -i '1s/^/Current Version :\n/' CHANGELOG

echo "Make last commit..."
git commit -a -m "New Release : $version"

if [ ! "$branch" = "master" ]; then
  echo "Merge branch $branch to master..."
  git checkout master
  git merge $branch

  read -p "Delete branch $branch ? (Y/n)" choice
  case "$choice" in 
    y|Y|'' )
      git branch -D $branch
    ;;
  esac
fi

read -p "Publish to server ? (Y/n)" choice
case "$choice" in 
  n|N )
    exit 1
  ;;
esac

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

git checkout master
echo "Push release..."
git push


#Sourceforge :

targetpath=.build/$version
mkdir -p $targetpath
cp -R * $targetpath

echo "Finalise archfi script..."
sed -i "/baseurl=/c\baseurl=http://downloads.sourceforge.net/project/archfi/release/$version" $targetpath/archfi

echo "Publish release..."
scp -r $targetpath matmoul@web.sourceforge.net:/home/frs/project/$prjname/release/

# Make redirect Page
#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
#scp -r $pubfile matmoul@web.sourceforge.net:/home/project-web/$prjname/htdocs/$prjname/
# End Make redirect Page

rm -R .build