Skip to content

Commit 0b62f98

Browse files
committed
Normalize version for OLM bundle
1 parent 59b6690 commit 0b62f98

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
VERSION ?= 0.38.1
2+
HELM_VERSION ?= 0.38.1
23

34
CHANNELS ?= alpha
45
BUNDLE_CHANNELS := --channels=$(CHANNELS)
@@ -60,7 +61,7 @@ help: ## Display this help.
6061

6162
.PHONY: sync-chart
6263
sync-chart: ## Sync helm chart.
63-
@./hack/sync-chart.sh $(VERSION)
64+
@./hack/sync-chart.sh $(HELM_VERSION)
6465

6566
##@ Build
6667

hack/bump-bundle.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@
22

33
set -euo pipefail
44

5-
VERSION=$1
5+
normalize_version() {
6+
local version="$1"
7+
IFS='.' read -r major minor patch <<< "$version"
8+
9+
# Remove leading zeroes safely by using arithmetic expansion
10+
major=$((10#$major))
11+
minor=$((10#$minor))
12+
patch=$((10#$patch))
13+
14+
echo "$major.$minor.$patch"
15+
}
16+
17+
INPUT_VERSION=$1
18+
VERSION=$(normalize_version "$INPUT_VERSION")
19+
20+
echo "📦 Input version: '$INPUT_VERSION'"
21+
echo "📦 Normalized to semver-compliant version: '$VERSION'"
622

723
echo "📦 Bumping bundle to version '$VERSION'"
824

925
echo "📦 Updating Makefile"
1026
sed -i "s/VERSION ?= .*/VERSION ?= $VERSION/g" Makefile
27+
sed -i "s/HELM_VERSION ?= .*/HELM_VERSION ?= $INPUT_VERSION/g" Makefile
1128

1229
echo "📦 Generating bundle"
1330
make bundle

0 commit comments

Comments
 (0)