|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # |
3 | | -# publishes nightly build |
| 3 | +# publishes nightly build if $publish_to is set in environment. |
| 4 | +# |
4 | 5 |
|
5 | | -[[ $# -eq 2 ]] || { |
| 6 | +[[ $# -eq 1 ]] || { |
6 | 7 | cat <<EOM |
7 | | -Usage: $0 <scala version> <rsync dest> |
| 8 | +Usage: $0 <scala version> |
| 9 | +
|
| 10 | +Environment variables: |
| 11 | + publish_to rsync destination |
8 | 12 | EOM |
9 | 13 | exit 0 |
10 | 14 | } |
| 15 | +version="$1" |
11 | 16 |
|
12 | 17 | [[ -d dists/archives ]] || { |
13 | 18 | echo "Can't find build, has it completed? No directory at dists/archives" |
14 | 19 | exit 1 |
15 | 20 | } |
16 | 21 |
|
17 | | -version="$1" |
18 | | -rsyncDest="$2" |
19 | | - |
20 | 22 | # should not be hardcoded |
21 | 23 | mavenSettings="/home/linuxsoft/apps/hudson-maven-settings/settings.xml" |
22 | 24 |
|
23 | | -echo "Copying nightly build to $rsyncDest" |
24 | | -# Archive Scala nightly distribution |
25 | | -rsync -az dists/archives/ "$rsyncDest/distributions" |
26 | | -# don't publish docs in 2.8.x |
27 | | -[[ $version == "2.8.x" ]] || rsync -az build/scaladoc/ "$rsyncDest/docs" |
28 | | -# sbaz |
29 | | -[[ -d dists/sbaz ]] && rsync -az dists/sbaz/ "$rsyncDest/sbaz" |
30 | | -# Deploy the maven artifacts on scala-tools.org |
31 | | -( cd dists/maven/latest && ant deploy.snapshot -Dsettings.file="$mavenSettings" ) |
| 25 | +if [[ -z $publish_to ]]; then |
| 26 | + echo "Nothing to publish." |
| 27 | +else |
| 28 | + echo "Publishing nightly build to $publish_to" |
| 29 | + # Archive Scala nightly distribution |
| 30 | + rsync -az dists/archives/ "$publish_to/distributions" |
| 31 | + # don't publish docs in 2.8.x |
| 32 | + [[ $version == "2.8.x" ]] || rsync -az build/scaladoc/ "$publish_to/docs" |
| 33 | + # sbaz |
| 34 | + [[ -d dists/sbaz ]] && rsync -az dists/sbaz/ "$publish_to/sbaz" |
| 35 | + # Deploy the maven artifacts on scala-tools.org |
| 36 | + ( cd dists/maven/latest && ant deploy.snapshot -Dsettings.file="$mavenSettings" ) |
| 37 | +fi |
0 commit comments