-
Notifications
You must be signed in to change notification settings - Fork 36
/
push
executable file
·42 lines (34 loc) · 1.37 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
# This script prepares the package for being pushed to the origin repository,
# if necessary, then pushes the package.
# Exit on unhandled error
set -e
# Redirect the standard output stream to the standard error stream
exec 1>&2
# Go to the top-level directory of the working tree.
cd `dirname $0`
# 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"
# Set the tag
tag="v$versionId"
# Ensure that the first line of file CHANGE_LOG has the current time
#awk 'NR==1{print $1"\t'`date --iso-8601=seconds`'"}NR>1' CHANGE_LOG \
#>CHANGE_LOG.tmp
#mv CHANGE_LOG.tmp CHANGE_LOG
#git commit -m $tag CHANGE_LOG
# Because GitHub interprets tagged commits as a release -- regardless of which
# branch they're on -- commits to branches other than the main branch are not
# tagged. As a consequence, however, commit times rather than tags must be
# used when investigating changes on branches other than the main branch.
if git status | head -1 | grep -E -i 'main|master' >/dev/null; then
# Tag the current version.
echo Tagging current version with \"$tag\"
git tag -f $tag
fi
git push "$@"