Joey Armstrong | a9deb69 | 2023-06-30 18:13:01 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Joey Armstrong | 6f63edf | 2024-01-12 11:30:08 -0500 | [diff] [blame] | 2 | # Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | c209e80 | 2021-06-07 16:59:30 +0200 | [diff] [blame] | 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 implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Joey Armstrong | a9deb69 | 2023-06-30 18:13:01 -0400 | [diff] [blame] | 15 | set -euo pipefail |
| 16 | |
| 17 | pgm_dir="${BASH_SOURCE[0]%/*}" |
| 18 | cd "$pgm_dir/.." |
| 19 | |
| 20 | NEW_VERSION="$(head -n1 'VERSION')" |
Matteo Scandolo | c209e80 | 2021-06-07 16:59:30 +0200 | [diff] [blame] | 21 | |
| 22 | if [[ "$NEW_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] |
| 23 | then |
| 24 | echo "Version string '$NEW_VERSION' is a SemVer released version!" |
Joey Armstrong | a9deb69 | 2023-06-30 18:13:01 -0400 | [diff] [blame] | 25 | declare -i SNAPSHOTS |
| 26 | SNAPSHOTS=$(grep --count "SNAPSHOT" 'dependencies.xml') |
| 27 | if [[ $SNAPSHOTS -gt 0 ]] |
Matteo Scandolo | c209e80 | 2021-06-07 16:59:30 +0200 | [diff] [blame] | 28 | then |
| 29 | echo "ERROR: Referring to -SNAPSHOT apps in a released VERSION" |
| 30 | exit 1 |
| 31 | fi |
Joey Armstrong | a9deb69 | 2023-06-30 18:13:01 -0400 | [diff] [blame] | 32 | |
| 33 | elif [[ "$NEW_VERSION" =~ '-dev' ]]; then |
| 34 | echo "** Developement version detected: $(declare -p NEW_VERSION)" |
| 35 | |
| 36 | else |
| 37 | echo "** Detected odd version string: $(declare -p NEW_VERSION)" |
Matteo Scandolo | c209e80 | 2021-06-07 16:59:30 +0200 | [diff] [blame] | 38 | fi |