forked from sonatype/nexus-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-to-staging.sh
executable file
·44 lines (35 loc) · 1.29 KB
/
deploy-to-staging.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
#!/bin/bash
# fail if anything errors
set -e
# fail if a function call is missing an argument
set -u
# load properties to be able to use them in here
source nexus-book.properties
echo "version set to $version"
function rsyncToDest {
source=$1
target=/var/www/domains/sonatype.com/www/shared/books/nexus-book/$2
options=$3
echo "Uploading $1 to $2 on $connection"
ssh $connection mkdir -pv $target
rsync -e ssh $options -av target/$source/ $connection:$target
}
if [ $publish_master == "true" ]; then
rsyncToDest site/reference/ reference --delete
rsyncToDest site/pdf/ pdf --delete
rsyncToDest site/other/ other --delete
fi
rsyncToDest site/$version $version --delete
if [ $publish_index == "true" ]; then
rsyncToDest site/index.html "" --delete
rsyncToDest site/sitemap.xml "" --delete
rsyncToDest site/sitemap-nexus-2.xml "" --delete
rsyncToDest site/sitemap-nexus-3.xml "" --delete
rsyncToDest site/js/ js --delete
rsyncToDest site/images/ images --delete
rsyncToDest site/css/ css --delete
rsyncToDest site/sitemap.xml "" --delete
fi
# Important to use separate rsync run WITHOUT --delete since its an archive! and we do NOT want old archives to be deleted
#rsyncToDest archive/ archive