@@ -13,4 +13,90 @@ build: ## Build for production
1313
1414.PHONY : install
1515install : # # Install dependencies
16- npm install
16+ npm install
17+
18+ # #@ Version Management
19+
20+ .PHONY : update-version
21+ update-version : # # Update version in Helm chart. Usage: make update-version VERSION=v1.0.1
22+ @if [ -z " $( VERSION) " ]; then \
23+ echo " ❌ Error: VERSION not specified. Usage: make update-version VERSION=v1.0.1" ; \
24+ exit 1; \
25+ fi
26+ @echo " 🔄 Updating operator-ui to $( VERSION) ..."
27+ @CHART_VERSION=$$ {VERSION#v}; \
28+ sed -i.bak " s/^version: .*/version: $$ CHART_VERSION/" helm/Chart.yaml
29+ @sed -i.bak " s/^appVersion: .*/appVersion: \" $( VERSION) \" /" helm/Chart.yaml
30+ @sed -i.bak " s/tag: \" .*\" /tag: \" $( VERSION) \" /" helm/values.yaml
31+ @sed -i.bak " s/^VERSION ?= .*/VERSION ?= $( VERSION) /" Makefile
32+ @rm -f helm/Chart.yaml.bak helm/values.yaml.bak Makefile.bak
33+ @echo " ✅ Updated operator-ui to $( VERSION) "
34+
35+ # #@ Helm Charts
36+
37+ .PHONY : helm-package
38+ helm-package : # # Package Helm chart
39+ @echo " 📦 Packaging Helm chart..."
40+ @CHART_VERSION=$$(grep '^version:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
41+ helm package helm/
42+ @echo " ✅ Helm chart packaged"
43+
44+ .PHONY : build-charts-site
45+ build-charts-site : helm-package # # Create charts directory for GitHub Pages
46+ @CHART_VERSION=$$(grep '^version:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
47+ CHART_FILE=" operator-ui-$$ CHART_VERSION.tgz" ; \
48+ CHARTS_DIR=" charts-site" ; \
49+ echo " 📦 Preparing charts site..." ; \
50+ mkdir -p " $$ CHARTS_DIR"
51+ @echo " 📥 Fetching existing charts from GitHub Pages..."
52+ @if curl -fsSL https://forkspacer.github.io/operator-ui/index.yaml -o /tmp/current-index.yaml 2> /dev/null; then \
53+ echo " ✅ Found existing Helm repository" ; \
54+ else \
55+ echo " ℹ️ No existing charts found (first deployment)" ; \
56+ fi
57+ @CHART_VERSION=$$(grep '^version:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
58+ CHART_FILE=" operator-ui-$$ CHART_VERSION.tgz" ; \
59+ CHARTS_DIR=" charts-site" ; \
60+ if [ -f /tmp/current-index.yaml ]; then \
61+ grep -oP ' https://forkspacer\.github\.io/operator-ui/operator-ui-[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?\.tgz' /tmp/current-index.yaml | sort -u | while read url; do \
62+ filename=$$(basename "$$url") ; \
63+ if [ " $$ filename" = " $$ CHART_FILE" ]; then \
64+ echo " ⏭️ Skipping $$ filename (will be replaced)" ; \
65+ continue ; \
66+ fi ; \
67+ echo " 📥 Downloading $$ filename..." ; \
68+ if curl -fsSL " $$ url" -o " $$ CHARTS_DIR/$$ filename" ; then \
69+ echo " ✅ Downloaded $$ filename" ; \
70+ else \
71+ echo " ⚠️ Failed to download $$ filename" ; \
72+ fi ; \
73+ done ; \
74+ fi
75+ @CHART_VERSION=$$(grep '^version:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
76+ CHART_FILE=" operator-ui-$$ CHART_VERSION.tgz" ; \
77+ CHARTS_DIR=" charts-site" ; \
78+ echo " ✅ Downloaded $$ (ls $$ CHARTS_DIR/operator-ui-*.tgz 2>/dev/null | wc -l) existing chart(s)" ; \
79+ cp " $$ CHART_FILE" " $$ CHARTS_DIR/" ; \
80+ echo " ✅ Added new chart: $$ CHART_FILE"
81+ @CHARTS_DIR=" charts-site" ; \
82+ echo " 📄 Generating Helm repo index..." ; \
83+ helm repo index " $$ CHARTS_DIR" --url https://forkspacer.github.io/operator-ui
84+ @CHARTS_DIR=" charts-site" ; \
85+ if [ -f " .github/templates/helm-page.html" ]; then \
86+ cp .github/templates/helm-page.html " $$ CHARTS_DIR/index.html" ; \
87+ else \
88+ echo " ⚠️ Warning: .github/templates/helm-page.html not found, skipping HTML generation" ; \
89+ fi
90+ @CHART_VERSION=$$(grep '^version:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
91+ APP_VERSION=$$(grep '^appVersion:' helm/Chart.yaml | awk '{print $$2}' | tr -d '"' | tr -d "'" ) ; \
92+ CHARTS_DIR=" charts-site" ; \
93+ if [ -f " $$ CHARTS_DIR/index.html" ]; then \
94+ sed -i " s/{{VERSION_TAG}}/$$ APP_VERSION/g" " $$ CHARTS_DIR/index.html" ; \
95+ sed -i " s/{{VERSION_NUMBER}}/$$ CHART_VERSION/g" " $$ CHARTS_DIR/index.html" ; \
96+ echo " ✅ Generated index.html from template" ; \
97+ fi
98+ @CHARTS_DIR=" charts-site" ; \
99+ echo " ✅ Charts site ready with $$ (ls $$ CHARTS_DIR/operator-ui-*.tgz 2>/dev/null | wc -l) chart version(s)" ; \
100+ echo " " ; \
101+ echo " 📦 Available versions:" ; \
102+ ls -lh $$ CHARTS_DIR/operator-ui-* .tgz 2> /dev/null || echo " No charts found"
0 commit comments