/
update-read-only-git-repos.sh
executable file
·50 lines (41 loc) · 2.54 KB
/
update-read-only-git-repos.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
#!/usr/bin/env bash
cd "$(dirname "$0")"
cd ../../
# Run helper subsplit script ported over from from https://raw.githubusercontent.com/dflydev/git-subsplit/master/git-subsplit.sh
CURRENT_VERSION=`git describe --abbrev=0`
CURRENT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
if [ -n "$(git status --porcelain)" ]; then
echo "Error: your git status is not clean. Aborting release.";
exit 1;
fi
if [[ $TRAVIS_TAG ]]; then
echo "This is a tagged git release so we will update read-only git repos...";
./scripts/release/git-subsplit.sh init https://${GH_TOKEN}@github.com/bolt-design-system/core-php.git
./scripts/release/git-subsplit.sh publish --work-dir=$PWD packages/core-php:https://${GH_TOKEN}@github.com/bolt-design-system/core-php.git \
--no-heads --update --tags="$CURRENT_VERSION"
rm -rf .subsplit
./scripts/release/git-subsplit.sh init https://${GH_TOKEN}@github.com/bolt-design-system/bolt_connect.git
./scripts/release/git-subsplit.sh publish --work-dir=$PWD packages/drupal-modules/bolt_connect:https://${GH_TOKEN}@github.com/bolt-design-system/bolt_connect.git \
--no-heads --update --tags="$CURRENT_VERSION"
rm -rf .subsplit
git checkout $CURRENT_BRANCH # return back to the branch you started on before exiting
echo "Finished syncing up the remote git repos!";
exit;
#@todo: update to support future major releases
elif [[ $CURRENT_BRANCH != 'release/2.x' && $CURRENT_BRANCH != 'release/1.x' && $CURRENT_BRANCH != 'master' && $CURRENT_BRANCH != 'next/2.x' && $CURRENT_BRANCH != 'next/3.x' ]]; then
echo "This is not a tagged git release or a release-related branch -- skipped updating remote repos!";
exit;
else
echo "This is not a tagged git release but it IS a release-related branch -- updating remote repos!"
./scripts/release/git-subsplit.sh init https://${GH_TOKEN}@github.com/bolt-design-system/core-php.git
./scripts/release/git-subsplit.sh publish --work-dir=$PWD packages/core-php:https://${GH_TOKEN}@github.com/bolt-design-system/core-php.git \
--heads="$CURRENT_BRANCH" --update --no-tags
rm -rf .subsplit
./scripts/release/git-subsplit.sh init https://${GH_TOKEN}@github.com/bolt-design-system/bolt_connect.git
./scripts/release/git-subsplit.sh publish --work-dir=$PWD packages/drupal-modules/bolt_connect:https://${GH_TOKEN}@github.com/bolt-design-system/bolt_connect.git \
--heads="$CURRENT_BRANCH" --update --no-tags
rm -rf .subsplit
git checkout $CURRENT_BRANCH # return back to the branch you started on before exiting
echo "Finished syncing up the remote git repos!";
exit;
fi