-
Notifications
You must be signed in to change notification settings - Fork 2
/
push
executable file
·38 lines (34 loc) · 1.17 KB
/
push
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
#!/bin/bash
set -e
if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
exit 0
fi
current_branch="$(git symbolic-ref --short -q HEAD || echo "$TRAVIS_BRANCH")"
declare -a branches
for arg; do
local_lib="${arg/*@/}"
[ "$local_lib" == "$arg" ] && unset local_lib
perl_version="${arg/@*/}"
remote_perl_version="$perl_version"
if [ "$current_branch" != "master" ]; then
remote_perl_version="$current_branch/$perl_version"
fi
if [ -z "$NO_COMMIT_PERL" ]; then
branches+=("perl/$perl_version:perl/$remote_perl_version")
fi
if [ -n "$local_lib" ]; then
branches+=("libs/$perl_version/$local_lib:libs/$remote_perl_version/$local_lib")
fi
done
if [ ! -e id_rsa.dec ]; then
cp id_rsa id_rsa.dec
chmod 600 id_rsa.dec
ssh-keygen -p -f id_rsa.dec -P "$SSH_KEY_PASS" -N '' || rm id_rsa.dec
fi
git config --replace-all [email protected]:.pushInsteadOf git://github.com/ '^git://github\.com/$'
git config --replace-all [email protected]:.pushInsteadOf https://github.com/ '^https://github\.com/$'
branches=($(
for branch in "${branches[@]}"; do echo $branch; done \
| sort -u
))
GIT_SSH=./ssh-wrapper git push builds "${branches[@]}"