|
| 1 | +#!/bin/bash |
| 2 | +# Copyright (c) 2024-2025, NVIDIA CORPORATION. |
| 3 | +############################### |
| 4 | +# Deployment Version Updater # |
| 5 | +############################### |
| 6 | + |
| 7 | +## Usage |
| 8 | +# bash update-version.sh <new_version> |
| 9 | + |
| 10 | +# Format is YY.MM.PP - no leading 'v' or trailing 'a' |
| 11 | +NEXT_FULL_TAG=$1 |
| 12 | + |
| 13 | +# Get <major>.<minor> for next version |
| 14 | +NEXT_MAJOR=$(echo "$NEXT_FULL_TAG" | awk '{split($0, a, "."); print a[1]}') |
| 15 | +NEXT_MINOR=$(echo "$NEXT_FULL_TAG" | awk '{split($0, a, "."); print a[2]}') |
| 16 | +NEXT_SHORT_TAG=${NEXT_MAJOR}.${NEXT_MINOR} |
| 17 | + |
| 18 | +# Calculate the next nightly version |
| 19 | +NEXT_MINOR_INT=$((10#$NEXT_MINOR)) |
| 20 | +NEXT_NIGHTLY_MINOR=$((NEXT_MINOR_INT + 2)) |
| 21 | +NEXT_NIGHTLY_MINOR=$(printf "%02d" $NEXT_NIGHTLY_MINOR) |
| 22 | +NEXT_NIGHTLY_TAG=${NEXT_MAJOR}.${NEXT_NIGHTLY_MINOR} |
| 23 | + |
| 24 | +echo "Preparing release $NEXT_FULL_TAG with next nightly version $NEXT_NIGHTLY_TAG" |
| 25 | + |
| 26 | +# Inplace sed replace; workaround for Linux and Mac |
| 27 | +function sed_runner() { |
| 28 | + sed -i.bak ''"$1"'' "$2" && rm -f "${2}".bak |
| 29 | +} |
| 30 | + |
| 31 | +# Update stable_version and nightly_version in conf.py |
| 32 | +sed_runner "s/stable_version = \"[0-9.]*\"/stable_version = \"${NEXT_SHORT_TAG}\"/" source/conf.py |
| 33 | +sed_runner "s/nightly_version = \"[0-9.]*\"/nightly_version = \"${NEXT_NIGHTLY_TAG}\"/" source/conf.py |
| 34 | + |
| 35 | +# Update container references in README.md |
| 36 | +sed_runner "s/\"rapids_container\": \"nvcr.io\/nvidia\/rapidsai\/base:[0-9.]*-/\"rapids_container\": \"nvcr.io\/nvidia\/rapidsai\/base:${NEXT_SHORT_TAG}-/" README.md |
| 37 | +sed_runner "s/\"rapids_container\": \"rapidsai\/base:[0-9.]*a-/\"rapids_container\": \"rapidsai\/base:${NEXT_NIGHTLY_TAG}a-/" README.md |
| 38 | + |
| 39 | +echo "Version update complete" |
0 commit comments