blob: e1fb354176514bea9cfc0defb8616ca1fadd50a6 [file] [log] [blame]
Joey Armstronga9deb692023-06-30 18:13:01 -04001#!/bin/bash
Joey Armstrong6f63edf2024-01-12 11:30:08 -05002# Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandoloc209e802021-06-07 16:59:30 +02003# 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 Armstronga9deb692023-06-30 18:13:01 -040015set -euo pipefail
16
17pgm_dir="${BASH_SOURCE[0]%/*}"
18cd "$pgm_dir/.."
19
20NEW_VERSION="$(head -n1 'VERSION')"
Matteo Scandoloc209e802021-06-07 16:59:30 +020021
22if [[ "$NEW_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
23then
24 echo "Version string '$NEW_VERSION' is a SemVer released version!"
Joey Armstronga9deb692023-06-30 18:13:01 -040025 declare -i SNAPSHOTS
26 SNAPSHOTS=$(grep --count "SNAPSHOT" 'dependencies.xml')
27 if [[ $SNAPSHOTS -gt 0 ]]
Matteo Scandoloc209e802021-06-07 16:59:30 +020028 then
29 echo "ERROR: Referring to -SNAPSHOT apps in a released VERSION"
30 exit 1
31 fi
Joey Armstronga9deb692023-06-30 18:13:01 -040032
33elif [[ "$NEW_VERSION" =~ '-dev' ]]; then
34 echo "** Developement version detected: $(declare -p NEW_VERSION)"
35
36else
37 echo "** Detected odd version string: $(declare -p NEW_VERSION)"
Matteo Scandoloc209e802021-06-07 16:59:30 +020038fi