-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconclude_merge.sh
executable file
·60 lines (52 loc) · 1.82 KB
/
conclude_merge.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
#!/bin/bash
echo -e "Enter the remote name (blank for origin):"
read remote
if [ -z $remote ] ; then
remote='origin'
fi
# Look through all the local git branches.
declare -a all_branches
IFS=$'\n' read -r -d '' -a all_branches < <( git branch && printf '\0' )
# Scan for z.y.x-security branches.
branch_re="^[ ]*(\* )?([0-9]+)\.([0-9]+)(\.([0-9]+))?(\-security)[ ]*$"
# Create a list of matching security tags and corresponding branches.
i=0
declare -a major
declare -a minor
declare -a patch
declare -a base
declare -a releases
declare -a branches
declare -a devbranches
declare -a next
for branch in "${all_branches[@]}" ; do
if [[ $branch =~ $branch_re ]] ; then
i=$((i + 1))
major[$i]="${BASH_REMATCH[2]}"
minor[$i]="${BASH_REMATCH[3]}"
patch[$i]="${BASH_REMATCH[5]}"
base[$i]="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
releases[$i]="${base[$i]}.${BASH_REMATCH[5]}"
branches[$i]="${base[$i]}.x"
devbranches[$i]="${branches[$i]}-dev"
next[$i]="${base[$i]}.$(( ${patch[$i]} + 1 ))"
fi
done
for i in "${!releases[@]}"; do
release="${releases[$i]}"
git checkout "${branches[$i]}"
rm -rf vendor
composer install --no-progress --no-suggest -n -q
COMPOSER_ROOT_VERSION="${devbranches[$i]}" composer update drupal/core*
git commit --amend -am "Merge $release, resolve merge conflicts, and update lockfile and dev versions." --no-verify
git branch -D "$release"-security
done
branch_list=$(IFS=' ' ; echo ${branches[*]})
tag_list=$(IFS=' ' ; echo ${releases[*]})
echo -e "\n\n ==== Check each branch, tag, and commit carefully before pushing! ====\n"
echo -e "To push, use:\n\n"
echo -e "git push $remote $tag_list"
echo -e "\nThen, create the release nodes to begin packaging."
echo -e "Once the release nodes have tarballs, then push the full branch data:"
echo -e "\ngit push $remote $branch_list"
echo -e "\n"