-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrelease-ftp.sh
executable file
·84 lines (67 loc) · 3.04 KB
/
release-ftp.sh
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
#!/usr/bin/env bash
#
#PBS -l walltime=00:05:00
#PBS -l mem=100Mb
echo Executing $0
# make it robust for running as a cron job
AWK=/usr/bin/awk
GIT=/usr/bin/git
GREP=/usr/bin/grep
LS=/usr/bin/ls
MAIL=/usr/bin/mail
ZIP=/usr/bin/zip
CURL=/usr/bin/curl
SCP=/usr/bin/scp
RSYNC=/usr/bin/rsync
# specify working directories
PROJECTDIR=/home/megmethods/roboos
FIELDTRIPDIR=$PROJECTDIR/fieldtrip/fieldtrip
RELEASEDIR=$PROJECTDIR/fieldtrip/release
FTPDIR=/home/common/matlab/fieldtrip/data/ftp
cd $FIELDTRIPDIR && git checkout release && git pull upstream release
TODAY=$(git log -1 --format=%cd --date=short | tr -d -)
REVISION=$(cd $FIELDTRIPDIR && git rev-parse --short HEAD)
BRANCH=$(cd $FIELDTRIPDIR && git rev-parse --abbrev-ref HEAD)
cd $RELEASEDIR || exit 1
$RSYNC -ar --copy-links --delete --exclude .git --exclude test $FIELDTRIPDIR/ $RELEASEDIR/release-ftp || exit 1
$RSYNC -ar --copy-links --delete --exclude .git --exclude test $FIELDTRIPDIR/fileio/ $RELEASEDIR/release-fileio || exit 1
$RSYNC -ar --copy-links --delete --exclude .git --exclude test $FIELDTRIPDIR/qsub/ $RELEASEDIR/release-qsub || exit 1
$RSYNC -ar --copy-links --delete --exclude .git --exclude test $FIELDTRIPDIR/realtime/src/buffer/ $RELEASEDIR/release-buffer || exit 1
LASTREVISION=$(cat revision)
if [[ "x$REVISION" = "x$LASTREVISION" ]]
then
echo the current release has not been updated compared to the previous
exit 0
else
echo the current release is an updated version
echo $REVISION > revision
# remove all older versions
rm daily/*.zip
mv release-ftp fieldtrip-$TODAY
$ZIP -r daily/fieldtrip-$TODAY.zip fieldtrip-$TODAY
$ZIP -r daily/fieldtrip-lite-$TODAY.zip fieldtrip-$TODAY [email protected]
mv fieldtrip-$TODAY release-ftp
mv release-fileio fileio-$TODAY
$ZIP -r daily/fileio-$TODAY.zip fileio-$TODAY
mv fileio-$TODAY release-fileio
mv release-qsub qsub-$TODAY
$ZIP -r daily/qsub-$TODAY.zip qsub-$TODAY
mv qsub-$TODAY release-qsub
mv release-buffer buffer-$TODAY
$ZIP -r daily/buffer-$TODAY.zip buffer-$TODAY
mv buffer-$TODAY release-buffer
# put all daily versions in place on the ftp server
cp daily/fieldtrip-$TODAY.zip $FTPDIR
cp daily/fieldtrip-lite-$TODAY.zip $FTPDIR
cp daily/fileio-$TODAY.zip $FTPDIR/modules
cp daily/qsub-$TODAY.zip $FTPDIR/modules
cp daily/buffer-$TODAY.zip $FTPDIR/modules
# tag it, this autmatically results in a release on github
cd $FIELDTRIPDIR && git tag $TODAY && git push upstream --tags
# push it to the EEGLAB server
$SCP $RELEASEDIR/daily/fileio-$TODAY.zip [email protected]:upload
$SCP $RELEASEDIR/daily/fieldtrip-lite-$TODAY.zip [email protected]:upload
# notify Arno that new plugin versions are available for inclusion in EEGLAB
$CURL "https://sccn.ucsd.edu/eeglab/plugin_uploader/update_donders.php?file=fileio-$TODAY.zip&version=$TODAY&name=Fileio"
$CURL "https://sccn.ucsd.edu/eeglab/plugin_uploader/update_donders.php?file=fieldtrip-lite-$TODAY.zip&version=$TODAY&name=Fieldtrip-lite"
fi