-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupgradeeformnugets.sh
More file actions
executable file
·146 lines (124 loc) · 5.57 KB
/
upgradeeformnugets.sh
File metadata and controls
executable file
·146 lines (124 loc) · 5.57 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
GIT_STATUS=`git status | grep "nothing to commit, working tree clean" | wc -l`
if (( "$GIT_STATUS" > 0 )); then
git checkout master
git pull
CURRENT_NUMBER_OF_COMMITS=`git log --oneline | wc -l`
cd eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn
PACKAGES=('Microting.eForm' 'Microting.eFormApi.BasePn' 'Microting.EformBackendConfigurationBase' 'Microting.ItemsPlanningBase' 'Microting.TimePlanningBase' 'Microting.EformAngularFrontendBase' 'Microting.eFormCaseTemplateBase' 'Google.Apis.Sheets.v4' 'Sentry')
PROJECT_NAME='BackendConfiguration.Pn.csproj'
REPOSITORY='eform-angular-backendconfiguration-plugin'
for PACKAGE_NAME in ${PACKAGES[@]}; do
OLD_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*' | grep -oP ' \d.* \b' | xargs`
dotnet add $PROJECT_NAME package $PACKAGE_NAME
NEW_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*$' | grep -oP '\d\.\d+\.\d.*$' | grep -oP ' \d\.\d+\.\d.*$' | xargs`
if [ $NEW_VERSION != $OLD_VERSION ]; then
echo "We have a new version of $PACKAGE_NAME, so creating github issue and do a commit message to close that said issue"
RESULT=`curl -X "POST" "https://api.github.com/repos/microting/$REPOSITORY/issues?state=all" \
-H "Cookie: logged_in=no" \
-H "Authorization: token $CHANGELOG_GITHUB_TOKEN" \
-H "Content-Type: text/plain; charset=utf-8" \
-d $'{
"title": "Bump '$PACKAGE_NAME' from '$OLD_VERSION' to '$NEW_VERSION'",
"body": "TBD",
"assignees": [
"renemadsen"
],
"labels": [
".NET",
"backend",
"enhancement"
]
}'`
ISSUE_NUMBER=`echo $RESULT | grep -oP 'number": \d+,' | grep -oP '\d+'`
git add .
git commit -a -m "closes #$ISSUE_NUMBER"
fi
done
cd ..
cd BackendConfiguration.Pn.Integration.Test
PACKAGES=('Microsoft.NET.Test.Sdk' 'NSubstitute' 'NUnit' 'NUnit3TestAdapter' 'NUnit.Analyzers' 'Testcontainers' 'Testcontainers.Mariadb')
PROJECT_NAME='BackendConfiguration.Pn.Integration.Test.csproj'
REPOSITORY='eform-angular-backendconfiguration-plugin'
for PACKAGE_NAME in ${PACKAGES[@]}; do
OLD_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*' | grep -oP ' \d.* \b' | xargs`
dotnet add $PROJECT_NAME package $PACKAGE_NAME
NEW_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*$' | grep -oP '\d\.\d+\.\d.*$' | grep -oP ' \d\.\d+\.\d.*$' | xargs`
if [ $NEW_VERSION != $OLD_VERSION ]; then
echo "We have a new version of $PACKAGE_NAME, so creating github issue and do a commit message to close that said issue"
RESULT=`curl -X "POST" "https://api.github.com/repos/microting/$REPOSITORY/issues?state=all" \
-H "Cookie: logged_in=no" \
-H "Authorization: token $CHANGELOG_GITHUB_TOKEN" \
-H "Content-Type: text/plain; charset=utf-8" \
-d $'{
"title": "Bump '$PACKAGE_NAME' from '$OLD_VERSION' to '$NEW_VERSION'",
"body": "TBD",
"assignees": [
"renemadsen"
],
"labels": [
".NET",
"backend",
"enhancement"
]
}'`
ISSUE_NUMBER=`echo $RESULT | grep -oP 'number": \d+,' | grep -oP '\d+'`
git add .
git commit -a -m "closes #$ISSUE_NUMBER"
fi
done
cd ..
cd BackendConfiguration.Pn.Test
PACKAGES=('Microsoft.NET.Test.Sdk' 'NSubstitute' 'NUnit' 'NUnit3TestAdapter' 'NUnit.Analyzers' 'Testcontainers' 'Testcontainers.Mariadb')
PROJECT_NAME='BackendConfiguration.Pn.Test.csproj'
REPOSITORY='eform-angular-backendconfiguration-plugin'
for PACKAGE_NAME in ${PACKAGES[@]}; do
OLD_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*' | grep -oP ' \d.* \b' | xargs`
dotnet add $PROJECT_NAME package $PACKAGE_NAME
NEW_VERSION=`dotnet list package | grep "$PACKAGE_NAME " | grep -oP ' \d\.\d+\.\d.*$' | grep -oP '\d\.\d+\.\d.*$' | grep -oP ' \d\.\d+\.\d.*$' | xargs`
if [ $NEW_VERSION != $OLD_VERSION ]; then
echo "We have a new version of $PACKAGE_NAME, so creating github issue and do a commit message to close that said issue"
RESULT=`curl -X "POST" "https://api.github.com/repos/microting/$REPOSITORY/issues?state=all" \
-H "Cookie: logged_in=no" \
-H "Authorization: token $CHANGELOG_GITHUB_TOKEN" \
-H "Content-Type: text/plain; charset=utf-8" \
-d $'{
"title": "Bump '$PACKAGE_NAME' from '$OLD_VERSION' to '$NEW_VERSION'",
"body": "TBD",
"assignees": [
"renemadsen"
],
"labels": [
".NET",
"backend",
"enhancement"
]
}'`
ISSUE_NUMBER=`echo $RESULT | grep -oP 'number": \d+,' | grep -oP '\d+'`
git add .
git commit -a -m "closes #$ISSUE_NUMBER"
fi
done
NEW_NUMBER_OF_COMMITS=`git log --oneline | wc -l`
if (( $NEW_NUMBER_OF_COMMITS > $CURRENT_NUMBER_OF_COMMITS )); then
CURRENT_GITVERSION=`git tag --sort=-creatordate | cut -d "v" -f 2 | sed -n 1p`
MAJOR_VERSION=`echo $CURRENT_GITVERSION | cut -d "." -f 1`
MINOR_VERSION=`echo $CURRENT_GITVERSION | cut -d "." -f 2`
BUILD_VERSION=`echo $CURRENT_GITVERSION | cut -d "." -f 3`
BUILD_VERSION=$(($BUILD_VERSION + 1))
NEW_GIT_VERSION="v$MAJOR_VERSION.$MINOR_VERSION.$BUILD_VERSION"
git tag "$NEW_GIT_VERSION"
git push --tags
git push
echo "Updated Microting eForm to ${EFORM_VERSION} and pushed new version ${NEW_GIT_VERSION}"
cd ../../../..
github_changelog_generator -u microting -p $REPOSITORY -t $CHANGELOG_GITHUB_TOKEN
git add CHANGELOG.md
git commit -m "Updating changelog"
git push
else
echo "nothing to do, everything is up to date."
fi
else
echo "Working tree is not clean, so we are not going to upgrade. Clean, before doing upgrade!"
fi