forked from Unidata/LDM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push
executable file
·48 lines (39 loc) · 1.56 KB
/
push
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
# This script prepares the package for being pushed to the origin repository;
# then pushes the package.
set -e # exit upon error
# Go to the top-level directory of the working tree.
cd `dirname $0`
if git branch | grep '^\* *master$' >/dev/null; then
# The push is to the master branch.
#
# Get and vet the package version information from the CHANGE_LOG file.
versionId=`awk '{print $1;exit}' CHANGE_LOG`
majorId=`echo $versionId | cut -d . -f 1`
minorId=`echo $versionId | cut -d . -f 2`
bugfixId=`echo $versionId | cut -d . -f 3`
rcId=`echo $versionId | cut -d . -f 4` # might be empty
test "$majorId"
test "$minorId"
test "$bugfixId"
## Ensure the current time in the top line of the CHANGE_LOG file.
awk 'NR==1{print $1"\t'`date --iso-8601=seconds`'"}NR>1' CHANGE_LOG \
>CHANGE_LOG.tmp
mv CHANGE_LOG.tmp CHANGE_LOG
# Set the package version in the autoconf configuration-file.
sed '/^AC_INIT(/s/\[[0-9][0-9.]*\]/['$versionId']/' configure.ac \
>configure.ac.tmp
mv configure.ac.tmp configure.ac
git add configure.ac
# Set the package version in the release-variables file.
sed "/^export *PKG_VERSION=/cexport PKG_VERSION=$versionId" \
delivery/release-vars.sh >delivery/release-vars.sh.tmp
mv delivery/release-vars.sh.tmp delivery/release-vars.sh
git add delivery/release-vars.sh
# Commit the changes.
git commit -a -m "v$versionId"
# Tag the current version.
git tag -f "v$versionId"
fi
# Push to the origin repository
git push
git push --force --tags