File: upload-to-builds.jabref.org.sh

package info (click to toggle)
jabref 3.8.1%2Bds-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,336 kB
  • sloc: java: 114,114; xml: 3,985; python: 283; sh: 282; perl: 200; ruby: 22; makefile: 6
file content (36 lines) | stat: -rwxr-xr-x 1,182 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

# We assume that there is a single build in build/releases
# We take out the branch name from the first matching file and then upload everything

# just to be sure
branch="snapshot"

# simple solution to treat first file matching a pattern
# hint by http://unix.stackexchange.com/a/156207/18033
for buildfile in build/releases/*--snapshot--*; do
  # the last "--" part is the branch name
  branch=`echo $buildfile | sed "sX.*--\(.*\)--.*X\1X"`
  break;
done

# now the branch name is in the variable "branch"

command="cd www/\n"

# if there was a branch determined, create that directory
# the for returns the literal string "build/releases/*--snapshot--*" if no file was found
# then, "snapshot" is extracted
if [ "snapshot" != "$branch" ] ; then
  # change into dir and delete old snapshots
  command="${command}mkdir $branch\ncd $branch\nrm *.dmg\nrm *.jar\nrm *.exe\n"
fi

#only upload [Jr]ab[Rr]ef*, not md5sums, updates.xml, etc.
command="${command}mput build/releases/jabref*\n"
command="${command}mput build/releases/JabRef*\n"
command="${command}exit\n"

# now $command is complete

echo -e "$command" | sftp -P 9922 builds_jabref_org@build-upload.jabref.org