Extracting stage releasenotes script from stage-test.sh
[osm/RO.git] / devops-stages / stage-releasenote.sh
1 #!/bin/bash
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -e
17 echo "Checking the presence of release notes ..."
18
19 nb_rn=$(git diff --diff-filter=A --name-only HEAD~1 |grep "releasenotes\/notes" |wc -l)
20 if [ "${nb_rn}" -lt 1 ]; then
21 echo "The commit needs release notes"
22 echo "Run the following command to generate release notes: tox -e release_notes '<release_note_title>'"
23 echo "Please read README.md for more details"
24 exit 1
25 elif [ "${nb_rn}" -gt 1 ]; then
26 echo "Only one release notes file should be added in a commit"
27 exit 1
28 fi
29
30 echo "OK. Release notes present in commit"