-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdeploy-preview
executable file
·60 lines (48 loc) · 1.27 KB
/
deploy-preview
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
#!/bin/bash
set -e
set -x
HARNESSES=(symfony)
function main()
{
local BRANCH_NAME="$1"
if [[ "$BRANCH_NAME" == "" ]]; then
echo "error: please provide a branch name to push to" >&2
exit 1
fi
if [[ "$BRANCH_NAME" =~ /^\d+\.\d+\.[0-9x]+$/ ]]; then
echo "error: can't push to a tag-like branch-name" >&2
exit 1
fi
if ! command -v splitsh-lite >/dev/null; then
echo "error: splitsh-lite is needed to be installed first" >&2
exit 1
fi
git checkout -b _build
build
for harness in "${HARNESSES[@]}"
do
set_remote "$harness" "[email protected]:inviqa/harness-${harness}.git"
splitsh-lite --prefix="src/${harness}" --target="publish/harness-${harness}"
git push -q -f "$harness" "publish/harness-${harness}:${BRANCH_NAME}"
done
git checkout "${BRANCH_NAME}"
git branch -D _build
}
function set_remote()
{
local name="$1"
local path="$2"
if ! git ls-remote --exit-code "$name" &>/dev/null; then
git remote add "$name" "$path"
fi
}
function build()
{
for harness in "${HARNESSES[@]}"
do
rsync -va --ignore-existing "./src/_base/" "./src/$harness"
git add .
git commit -m "publish '${harness}' harness"
done
}
main "$1"