-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange-default-branch-nextcloud-requirements-multi.sh
executable file
·94 lines (75 loc) · 2.13 KB
/
change-default-branch-nextcloud-requirements-multi.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#
# Checkout and update the branch on all repos
NEW_VERSION=$1
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
REPO=${PWD##*/}
echo "Fetch $DEFAULT_BRANCH"
echo "======================"
git fetch origin $DEFAULT_BRANCH
echo "Checkout $DEFAULT_BRANCH"
echo "======================"
git checkout $DEFAULT_BRANCH
echo "Checkout $DEFAULT_BRANCH"
echo "======================"
git reset --hard origin/$DEFAULT_BRANCH
echo ""
echo "Delete existing branch"
echo "======================"
git branch -D update-$DEFAULT_BRANCH-version
echo ""
echo "Checkout branch"
echo "======================"
git checkout -b update-$DEFAULT_BRANCH-version
set -e
php ../../bump-version.php $PWD $NEW_VERSION
CHANGED="0"
for FILE in appinfo/info.xml \
package.json \
renovate.json \
.github/dependabot.yml \
.github/workflows/phpunit-mysql.yml \
.github/workflows/phpunit-sqlite.yml \
.github/workflows/npm-audit-fix.yml \
.github/workflows/update-nextcloud-ocp-matrix.yml \
.github/workflows/psalm-matrix.yml
do
if [ -f $FILE ]; then
if [[ "$FILE" = "package.json" ]]; then
npm version --no-git-tag-version $(xmllint --xpath '/info/version/text()' appinfo/info.xml)
git diff
git add package.json
git add package-lock.json
CHANGED="1"
continue
fi
echo ""
echo "Update $FILE"
echo "======================"
gnome-text-editor $FILE
echo ""
echo "Add file to git status"
echo "======================"
git add $FILE
CHANGED="1"
fi
done
set +e
git status
if [[ "$CHANGED" = "0" ]]; then
echo -e "\033[1;35m🏳 No update needed\033[0m"
exit 1
fi
echo ""
echo "Commit branch"
echo "======================"
git commit -m "feat(deps): Add Nextcloud $NEW_VERSION support
Signed-off-by: Joas Schilling <coding@schilljs.com>"
echo ""
echo "Push branch"
echo "======================"
git push --force origin update-$DEFAULT_BRANCH-version
echo ""
echo "Create PR"
echo "======================"
gh pr create --base $DEFAULT_BRANCH --fill >> ../../pr-list.txt