/
publish.sh
139 lines (121 loc) · 3.78 KB
/
publish.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
commit_wiki_files() {
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis CI"
git config --global push.default simple
cd ..
git clone --depth=50 --branch=master https://github.com/gama-platform/gama.wiki.git gama.wiki
cd /home/travis/build/gama-platform/gama/msi.gama.documentation/
java -cp ".:libs/jdom-2.0.1.jar:target/classes:../ummisco.gama.annotations/target/classes" msi.gama.doc.MainGenerateWiki -online
cd /home/travis/build/gama-platform/gama.wiki
git remote rm origin
git remote add origin https://gama-bot:$BOT_TOKEN@github.com/gama-platform/gama.wiki.git
git status
git add -A
git commit -m "Regenerate operators artifacts on wiki - $(date)"
git push origin HEAD:master
}
commit_io_website_files() {
echo "Trigger to githubio"
git config --global user.email "my.gama.bot@gmail.com"
git config --global user.name "GAMA Bot"
git config --global push.default simple
git clone https://github.com/gama-platform/gama-platform.github.io.git ~/gama-platform.github.io
cd ~/gama-platform.github.io
git remote rm origin
git remote add origin https://gama-bot:$BOT_TOKEN@github.com/gama-platform/gama-platform.github.io.git
git fetch origin
git checkout --track origin/sources
#git branch --set-upstream-to=origin/sources sources
echo "pulling"
git pull
echo "Travis build trigger from gama core at $(date)" > log.gaml
git status
git add log.gaml
git commit -m "Trigger to generate docs - $(date)"
git push
}
function update_tag() {
echo "update tag " $1
git config --global user.email "my.gama.bot@gmail.com"
git config --global user.name "GAMA Bot"
git remote rm origin
git remote add origin https://gama-bot:$BOT_TOKEN@github.com/gama-platform/gama.git
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch
git checkout master
git pull origin master
git push origin :refs/tags/$1
git tag -d $1
git tag -fa $1 -m "$1"
git push --tags -f
git ls-remote --tags origin
git show-ref --tags
}
clean(){
echo "Clean p2 update site"
sshpass -e ssh gamaws@51.255.46.42 /var/www/gama_updates/clean.sh
}
deploy(){
echo "Deploy to p2 update site"
bash ./travis/deploy.sh
}
embed_jdk(){
bash ./travis/zip_withjdk.sh "$TRAVIS_COMMIT"
}
release_official(){
echo "Upload release to github"
bash ./travis/github_release_official.sh "$TRAVIS_COMMIT"
}
release_181(){
echo "Upload continuous/on-demand release to github"
bash ./travis/github_release_181_withjdk.sh "$TRAVIS_COMMIT"
}
release_continuous(){
echo "Upload continuous/on-demand release to github"
bash ./travis/github_release_withjdk.sh "$TRAVIS_COMMIT"
}
release_monthly(){
echo "Upload monthly release to github"
bash ./travis/github_release_monthly_withjdk.sh "$TRAVIS_COMMIT"
}
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
echo $MESSAGE
if [[ ${MESSAGE} == *"ci ext"* ]]; then
MSG+=" ci ext "
fi
if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]] || [[ $MSG == *"ci cron"* ]]; then
change=$(git log --pretty=format: --name-only --since="1 day ago")
if [[ ${change} == *"msi.gama.ext"* ]]; then
MSG+=" ci ext "
fi
deploy
embed_jdk
release_continuous
if [[ $(date +%d) =~ 0[1-1] ]]; then
release_monthly
fi
commit_wiki_files
commit_io_website_files
else
if [[ ${MESSAGE} == *"ci deploy"* ]] || [[ $MSG == *"ci deploy"* ]]; then
if [[ ${MESSAGE} == *"ci clean"* ]] || [[ $MSG == *"ci clean"* ]]; then
clean
MSG+=" ci ext "
echo $MSG
fi
deploy
fi
if [[ ${MESSAGE} == *"ci docs"* ]] || [[ $MSG == *"ci docs"* ]]; then
commit_wiki_files
commit_io_website_files
fi
if [[ ${MESSAGE} == *"ci 181"* ]] || [[ $MSG == *"ci 181"* ]]; then
embed_jdk
release_181
fi
if [[ ${MESSAGE} == *"ci release"* ]] || [[ $MSG == *"ci release"* ]]; then
embed_jdk
release_continuous
fi
fi