forked from hyperledger/fabric-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-versions.sh
executable file
·35 lines (27 loc) · 1.14 KB
/
update-versions.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
#!/usr/bin/env bash
set -eu -o pipefail
PROJECT_DIR="$( cd "$( dirname -- "${BASH_SOURCE[0]}" )/.." > /dev/null && pwd )"
VERIFY_VERSIONS="${PROJECT_DIR}/.github/workflows/verify-versions.yml"
JAVA_DIR="${PROJECT_DIR}/java"
NODE_DIR="${PROJECT_DIR}/node"
if [ $# -eq 1 ]; then
NEXT_VERSION="$1"
else
NEXT_VERSION="$(
awk 'match($0, /^[ \t]*GATEWAY_VERSION:[ \t]*([0-9]+)\.([0-9]+)\.([0-9]+)/, v) {
printf "%d.%d.%d", v[1], v[2], v[3]+1
exit
}' \
"${VERIFY_VERSIONS}"
)"
fi
NEXT_JAVA_VERSION="${NEXT_VERSION}-SNAPSHOT"
echo "Updating Java version to ${NEXT_JAVA_VERSION}"
( cd "${JAVA_DIR}" && \
mvn --batch-mode --quiet versions:set -DnewVersion="${NEXT_JAVA_VERSION}" -DgenerateBackupPoms=false )
echo "Updating Node version to ${NEXT_VERSION}"
( cd "${NODE_DIR}" && \
npm --allow-same-version --no-git-tag-version version "${NEXT_VERSION}" )
echo "Updating verify-versions.yml to ${NEXT_VERSION}"
NEXT_VERIFY_VERSIONS="$( sed -r "s/^([ \t]*GATEWAY_VERSION:[ \t]*)[0-9.]+/\1${NEXT_VERSION}/" "${VERIFY_VERSIONS}" )"
echo "${NEXT_VERIFY_VERSIONS}" > "${VERIFY_VERSIONS}"