summaryrefslogtreecommitdiffstats
path: root/jenkins-builds/promote-to-release.sh
blob: 8ab1ff08b8cda264903f16fc736ccee446a9fec4 (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
#! /bin/bash

##
#
# Will promote an aggregated/archived folder to a webstart folder.
#   - cd root-dir ; cp -a rel-aggregation-dir -> rel-storage-dir/version ; ln -s rel-storage-dir/version .
#
# promote-to-release.sh <version> <root-dir> <rel-aggregation-dir> <rel-storage-dir> <url-base>
# eg.
#   promote-to-release.sh v2.4.0-rc-20200104 \
#                          /srv/www/jogamp.org/deployment \
#                          archive/master/gluegen_930-joal_652-jogl_1493-jocl_1137 \
#                          archive/rc \
#                          https://jogamp.org/deployment \
#
##

version=$1
shift

rootdir=$1
shift

relaggregationdir=$1
shift

relstoragedir=$1
shift

urlbase=$1
shift

if [ -z "$version" -o -z "$rootdir" -o -z "$relaggregationdir" -o -z "$relstoragedir" -o -z "$urlbase" ] ; then
    echo "usage $0 version root-dir rel-aggregation-dir rel-storage-dir url-base"
    exit 1
fi

if [ ! -e "$rootdir" ] ; then
    echo root-dir $rootdir does not exist
    exit 1
fi

if [ ! -e "$rootdir/$relaggregationdir" ] ; then
    echo root-dir/rel-aggregation-dir $rootdir/$relaggregationdir does not exist
    exit 1
fi

if [ ! -e "$rootdir/$relstoragedir" ] ; then
    echo root-dir/rel-storage-dir $rootdir/$relstoragedir does not exist
    exit 1
fi

if [ -e "$rootdir/$relstoragedir/$version" ] ; then
    echo root-dir/rel-storage-dir/version $rootdir/$relstoragedir/$version already exists
    exit 1
fi

sdir=`dirname $0`

thisdir=`pwd`

logfile=$thisdir/`basename $0 .sh`.log

function echo_info() {
    echo
    echo "Promotion release jars"
    echo
    echo "  Version $version"
    echo "  Root $rootdir"
    echo "  Copy $relaggregationdir -> $relstoragedir"
    echo "  URL Base $urlbase"
    echo
    echo `date`
    echo
}

echo_info 2>&1 | tee $logfile

cd $rootdir

cp -a $relaggregationdir $relstoragedir/$version 2>&1 | tee $logfile
ln -s $relstoragedir/$version . 2>&1 | tee $logfile