summaryrefslogtreecommitdiff
path: root/release.sh
blob: d64f298b2eb69e4054b6ac3724d1a15c3e503314 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash

### CONFIG - Please edit this section before using this script
VERSION_MAJ=1
VERSION_MIN=23
OLD_VERSION_MIN=22
VERSION_MIC=0
OLD_VERSION_MIC=0
PRE_RELEASE_STRING="-alpha1" # "", "-alpha1", "-beta1", ...
OLD_PRE_RELEASE_STRING=""

#OLD_VERSION_MIC=$(let $VERSION_MIC-1)
VERSION_SIMPLE="$VERSION_MAJ.$VERSION_MIN.$VERSION_MIC"
VERSION="$VERSION_SIMPLE$PRE_RELEASE_STRING"
OLD_VERSION="$VERSION_MAJ.$OLD_VERSION_MIN.$OLD_VERSION_MIC$OLD_PRE_RELEASE_STRING"
EDITOR="vim"
MAJOR=0
FINALISE=0
PREPARE=0

# fail on errors
set -e
#set -x

get_news()
{
	$EDITOR meson.build || exit 1
	echo "Changes since $OLD_VERSION:" >> NEWS
	echo -e "---------------------\n" >> NEWS
	../release-management/generate_news.py v$OLD_VERSION..HEAD >> NEWS || exit 1
	git diff || exit 1
	$EDITOR NEWS || exit 1
	git diff || exit 1
	git commit -v meson.build NEWS -m "release: Update NEWS and bump version for $VERSION release" || exit 1
	git show || exit 1
}

do_compile()
{
	meson build-efl-$VERSION
	ninja -C build-efl-$VERSION dist

#	ninja -C build-efl-$VERSION doc
}

do_package_and_upload()
{
	echo
	echo "Package efl"
	echo

	cd efl

	get_news
	do_compile

	cp build-efl-$VERSION/meson-dist/efl-$VERSION_SIMPLE.tar.xz efl-$VERSION.tar.xz
	cp build-efl-$VERSION/meson-dist/efl-$VERSION_SIMPLE.tar.xz.sha256sum efl-$VERSION.tar.xz.sha256sum

	if [ $MAJOR = 0 ]
	then
		mv efl-$VERSION.tar.xz efl-$VERSION-pre.tar.xz
		mv efl-$VERSION.tar.xz.sha256 efl-$VERSION-pre.tar.xz.sha256
		scp efl-$VERSION-pre.tar.* download.enlightenment.org:/srv/web/download.enlightenment.org/pre-releases/
	fi

	scp efl-$VERSION.tar.* download.enlightenment.org:/srv/web/download.enlightenment.org/pre-releases/

	cd ..
	echo
	echo "Packaged and uploaded efl. Please push changes to repo now."
	echo
}

do_finalize_release()
{
	echo
	echo "Finalize efl"
	echo

	cd efl
	git tag -a v$VERSION -m "v$VERSION" || exit 1

#	if [ $MAJOR = 1 ]
#	then
#		git branch efl-$VERSION_MAJ.$VERSION_MIN
#		git push origin efl-$VERSION_MAJ.$VERSION_MIN:efl-$VERSION_MAJ.$VERSION_MIN
#	fi

	echo "Move tarballs to final destination"
	if [ $MAJOR = 0 ]
	then
		ssh download.enlightenment.org mv /srv/web/download.enlightenment.org/pre-releases/efl-$VERSION-pre.tar.xz /srv/web/download.enlightenment.org/rel/libs/efl/efl-$VERSION.tar.xz
		ssh download.enlightenment.org mv /srv/web/download.enlightenment.org/pre-releases/efl-$VERSION-pre.tar.xz.sha256 /srv/web/download.enlightenment.org/rel/libs/efl/efl-$VERSION.tar.xz.sha256
	else
		ssh download.enlightenment.org mv /srv/web/download.enlightenment.org/pre-releases/efl-$VERSION.tar.* /srv/web/download.enlightenment.org/rel/libs/efl/

#		scp efl-$VERSION-doc.tar.bz2 download.enlightenment.org:/srv/web/docs.enlightenment.org/efl/
#		ssh download.enlightenment.org tar xf /srv/web/docs.enlightenment.org/efl/efl-$VERSION-doc.tar.xz -C /srv/web/docs.enlightenment.org/efl/
#		ssh download.enlightenment.org rm -r /srv/web/docs.enlightenment.org/efl/$VERSION_SIMPLE
#		ssh download.enlightenment.org mv /srv/web/docs.enlightenment.org/efl/html /srv/web/docs.enlightenment.org/efl/$VERSION_SIMPLE
#		ssh download.enlightenment.org rm /srv/web/docs.enlightenment.org/efl/efl-$VERSION-doc.tar.xz

#		ssh download.enlightenment.org rm /srv/web/docs.enlightenment.org/efl/current
#		ssh download.enlightenment.org ln -s /srv/web/docs.enlightenment.org/efl/$VERSION_SIMPLE /srv/web/docs.enlightenment.org/efl/current
	fi

	cd ..
	echo
	echo "Finalized efl. Please push changes to repo now."
	echo
}

usage()
{
local scriptname
scriptname="`basename $0`"
cat <<EOF
Usage:
$scriptname [--major] [--prepare] [--finalise]

$scriptname prepares and uploads a release.

Options:

  --major    Handle extra steps needed for a major release
  --prepare  Release preparations. Everything to upload the tarballs.
  --finalise Finalise a release. Move to the right location, git tags, etc
  --help     Show this message

EOF
exit 0
}

while [ $# -ge 1 ]
do
	case "$1" in
	--major)
		MAJOR=1
		;;
	--prepare)
		PREPARE=1
		;;
	--finalise)
		FINALISE=1
		;;
	--help)
		usage
		;;
	-*)
		echo "Unknown option $1" >&2
		exit 1
		;;
	esac
	shift
done

if [ ! -d "efl" ]
then
	echo "efl directory missing?"
	exit 1
fi

if [ $PREPARE = 1 ]
then
	do_package_and_upload
fi
if [ $FINALISE = 1 ]
then
	do_finalize_release
fi