-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·77 lines (59 loc) · 1.6 KB
/
run.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# Lets take the configs:
source config
source colors
# Marking our commands from the default ones
header="${magenta}[git faker]${nc}"
# just some magic to the script
echo -e "${header} Using the ${yellow}LOCAL${nc} repo ${green}${local_repo}${nc} for testing"
cd $local_repo
clear_repository(){
# Cleaning up
echo -e "${header} Deleting everything"
rm -rf .git
rm *.txt
}
base_init(){
echo -e "${header} Initializing empty repository"
git init
echo -e "${header} Creating first commit"
echo -e "# Releaser Sample" > README.md
git add . && git commit -m "First commit - README"
}
create_local_branches(){
echo -e "${header} Preparing local branches"
for branch in ${release_pipeline[*]}
do
git branch ${branch}
done
}
create_dummy_commits(){
echo -e "${header} Creating dummy commits"
for ((step=1 ; step<=$max_objects ; step++));
do
echo "content ${step}" > "file${step}.txt"
git add .
git commit -m "Commit ${step}"
done
}
push_all_to_remote(){
echo "${header} Push IT!"
for branch in ${release_pipeline[*]}
do
echo -e "${header} FORCE Pushing origin ${red} $branch ${nc}"
git push -f origin $branch
done
}
# run all
clear_repository
base_init
create_local_branches
create_dummy_commits
# If is remote, replicate the repo to the remote repository
if [[ $1 = 'remote' ]]
then
echo -e "${header} Using the ${red}REMOTE${nc} repo ${green}${remote_repo}${nc} for testing"
echo -e "${header} Adding remote"
git remote add origin $remote_repo
push_all_to_remote
fi