-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-template-components.sh
executable file
·51 lines (41 loc) · 1.29 KB
/
update-template-components.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
for repo in "[email protected]:CloudCannon/urban-jekyll-bookshop-template.git" \
"[email protected]:CloudCannon/cause-jekyll-bookshop-template.git" \
"[email protected]:CloudCannon/justice-jekyll-bookshop-template.git" \
"[email protected]:CloudCannon/hydra-jekyll-bookshop-template.git"
do
git clone $repo ../repo
cd ../repo
git remote add cc-template-components [email protected]:CloudCannon/cc-template-components.git
git fetch cc-template-components
git branch cc-template-components_main cc-template-components/main
for folder in components
do
git checkout -f cc-template-components_main
git subtree split --prefix=$folder -b temp_branch
git checkout -f staging
if [ -d component-library ]
then
git subtree merge --prefix=component-library temp_branch
else
git subtree add --prefix=component-library temp_branch
fi
git branch -D temp_branch
done
mkdir -p site
for folder in _includes _layouts assets
do
git checkout -f cc-template-components_main
git subtree split --prefix=$folder -b temp_branch
git checkout -f staging
if [ -d site/$folder ]
then
git subtree merge --prefix=site/$folder temp_branch
else
git subtree add --prefix=site/$folder temp_branch
fi
git branch -D temp_branch
done
git push
cd ../cc-template-components
rm -rf ../repo
done