Skip to content

Commit 4ef6b07

Browse files
committed
(feat) Update prepare-release.sh to bump patch version in both manifest and README
1 parent 1bca3d1 commit 4ef6b07

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

build/prepare-release.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,38 @@ bump_version() {
3838
version=$(grep -oP '(?<="version": ")[^"]*' $manifestPath)
3939
newVersion=$(echo $version | awk -F. -v OFS=. '{$NF += 1 ; print}')
4040
sed -i "s/\"version\": \"$version\"/\"version\": \"$newVersion\"/g" $manifestPath
41+
42+
# Also update version references in README.md
43+
update_readme_version $directory $version $newVersion
44+
}
45+
46+
update_readme_version() {
47+
directory=$1
48+
oldVersion=$2
49+
newVersion=$3
50+
readmePath="$directory/README.md"
51+
52+
if [ ! -f "$readmePath" ]; then
53+
echo "No README.md found at $readmePath, skipping README update"
54+
return
55+
fi
56+
57+
# Extract major.minor from the version
58+
majorMinor=$(echo $oldVersion | cut -d. -f1,2)
59+
60+
# Check if major.minor version pattern exists in README
61+
# Match :major.minor.patch followed by either - or ` (backtick) or end of word
62+
if ! grep -qE ":${majorMinor}\.[0-9]+(-|\`)" "$readmePath"; then
63+
echo "ERROR: Version pattern ${majorMinor}.x not found in $readmePath"
64+
exit 1
65+
fi
66+
67+
# Update full version references (e.g., 1.3.x-variant -> 1.3.3-variant, or 1.3.x` -> 1.3.3`)
68+
# The pattern matches major.minor.any_patch followed by - (variant) or ` (backtick)
69+
sed -i "s/:${majorMinor}\.[0-9]*-/:${newVersion}-/g" $readmePath
70+
sed -i "s/:${majorMinor}\.[0-9]*\`/:${newVersion}\`/g" $readmePath
71+
72+
echo "Updated README.md version references from ${majorMinor}.x to $newVersion"
4173
}
4274

4375
release_image() {

src/java/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ Refer to [this guide](https://containers.dev/guide/dockerfile) for more details.
3131

3232
You can decide how often you want updates by referencing a [semantic version](https://semver.org/) of each image. For example:
3333

34-
- `mcr.microsoft.com/devcontainers/java:2-11` (or `2-11-trixie`, `2-11-bookworm` to pin to an OS version)
35-
- `mcr.microsoft.com/devcontainers/java:2.0-11` (or `2.0-11-trixie`, `2.0-11-bookworm` to pin to an OS version)
36-
- `mcr.microsoft.com/devcontainers/java:2.0.0-11` (or `2.0.0-11-trixie`, `2.0.0-11-bookworm` to pin to an OS version)
34+
- `mcr.microsoft.com/devcontainers/java:3-11` (or `3-11-trixie`, `3-11-bookworm` to pin to an OS version)
35+
- `mcr.microsoft.com/devcontainers/java:3.0-11` (or `3.0-11-trixie`, `3.0-11-bookworm` to pin to an OS version)
36+
- `mcr.microsoft.com/devcontainers/java:3.0.5-11` (or `3.0.0-11-trixie`, `3.0.0-11-bookworm` to pin to an OS version)
3737

38-
However, we only do security patching on the latest [non-breaking, in support](https://github.com/devcontainers/images/issues/90) versions of images (e.g. `2-11`). You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates.
38+
However, we only do security patching on the latest [non-breaking, in support](https://github.com/devcontainers/images/issues/90) versions of images (e.g. `3-11`). You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates.
3939

4040
See [history](history) for information on the contents of each version and [here for a complete list of available tags](https://mcr.microsoft.com/v2/devcontainers/java/tags/list).
4141

src/miniconda/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Refer to [this guide](https://containers.dev/guide/dockerfile) for more details.
2929
You can decide how often you want updates by referencing a [semantic version](https://semver.org/) of each image. For example:
3030

3131
- `mcr.microsoft.com/devcontainers/miniconda:1-3`
32-
- `mcr.microsoft.com/devcontainers/miniconda:1.0-3`
33-
- `mcr.microsoft.com/devcontainers/miniconda:1.0.0-3`
32+
- `mcr.microsoft.com/devcontainers/miniconda:1.1-3`
33+
- `mcr.microsoft.com/devcontainers/miniconda:1.1.0-3`
3434

3535
See [history](history) for information on the contents of each version and [here for a complete list of available tags](https://mcr.microsoft.com/v2/devcontainers/miniconda/tags/list).
3636

0 commit comments

Comments
 (0)