-
Notifications
You must be signed in to change notification settings - Fork 17
/
publish.sh
executable file
·40 lines (34 loc) · 959 Bytes
/
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
#!/bin/bash
set -e
function fatal() {
echo "$1"
exit 1
}
version_pattern="[0-9]+\.[0-9]+\.[0-9]+"
function get_version() {
grep 'version="[^"]*qualifier"' editorconfig-eclipse-feature/feature.xml \
| head -1 \
| sed -r "s/.*(${version_pattern}).*/\1/" \
| grep -P "^${version_pattern}$"
}
version="$(get_version)" || fatal "bad version"
cd "$(dirname "$0")"
site_src_dir=site/src
site_build_dir=site/target
p2_repo_dir=editorconfig-eclipse-p2/target/repository
rm -rf "$site_build_dir"
mkdir "$site_build_dir"
if [[ ! -d "$p2_repo_dir" ]]; then
echo "ERROR: $p2_repo_dir does not exist. Run 'mvn install'."
exit 1
fi
cp -r "$p2_repo_dir" "$site_build_dir"
cp -r "$site_src_dir"/* "$site_build_dir"
cd "$site_build_dir"
git init
git add .
git commit -m 'add p2 repo'
git tag "$version"
git remote add origin [email protected]:editorconfig-eclipse/editorconfig-eclipse.github.io.git
git push origin "$version"
git push -f origin master