File tree Expand file tree Collapse file tree 4 files changed +57
-1
lines changed Expand file tree Collapse file tree 4 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 1+ apiVersion : v2
2+ name : catalogi
3+ description : A Helm chart for deploying the Catalogi open source software catalog.
4+ type : application
5+ version : 0.1.0
6+ appVersion : 1.50.2
7+ dependencies :
8+ - name : postgresql
9+ version : ' 16'
10+ repository : https://charts.bitnami.com/bitnami
11+ condition : postgresql.enabled
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ pre-commit:
33 format :
44 run : yarn format
55 stage_fixed : true
6+ sync-helm-version :
7+ glob : " {package.json,helm-charts/catalogi/Chart.yaml}"
8+ run : yarn sync-helm-charts
9+ stage_fixed : true
610 lint :
711 run : yarn turbo lint
812
Original file line number Diff line number Diff line change 1111 "format" : " turbo format" ,
1212 "format:check" : " turbo format:check" ,
1313 "fullcheck" : " turbo typecheck format:check lint test" ,
14- "turbo" : " turbo"
14+ "turbo" : " turbo" ,
15+ "sync-helm-charts" : " node scripts/sync-helm-app-version.js"
1516 },
1617 "devDependencies" : {
1718 "@commitlint/cli" : " ^19.8.0" ,
1819 "@commitlint/config-conventional" : " ^19.8.0" ,
20+ "js-yaml" : " ^4.1.0" ,
1921 "lefthook" : " ^1.10.10" ,
2022 "turbo" : " ^1.12.5"
2123 },
Original file line number Diff line number Diff line change 1+ const fs = require ( "fs" ) ;
2+ const path = require ( "path" ) ;
3+ const yaml = require ( "js-yaml" ) ;
4+
5+ const rootDir = path . join ( __dirname , ".." ) ;
6+ const rootPackageJsonPath = path . join ( rootDir , "package.json" ) ;
7+ const chartYamlPath = path . join (
8+ rootDir ,
9+ "helm-charts" ,
10+ "catalogi" ,
11+ "Chart.yaml" ,
12+ ) ;
13+
14+ try {
15+ const packageJsonContent = fs . readFileSync ( rootPackageJsonPath , "utf8" ) ;
16+ const { version : appVersion } = JSON . parse ( packageJsonContent ) ;
17+
18+ if ( ! appVersion ) {
19+ throw new Error ( "Version not found in root package.json" ) ;
20+ }
21+
22+ const chartYamlContent = fs . readFileSync ( chartYamlPath , "utf8" ) ;
23+ const chartYaml = yaml . load ( chartYamlContent ) ;
24+
25+ if ( chartYaml . appVersion !== appVersion ) {
26+ console . log (
27+ `Updating Helm chart appVersion from ${ chartYaml . appVersion } to ${ appVersion } ...` ,
28+ ) ;
29+ chartYaml . appVersion = appVersion ;
30+ const newChartYamlContent = yaml . dump ( chartYaml ) ;
31+ fs . writeFileSync ( chartYamlPath , newChartYamlContent , "utf8" ) ;
32+ console . log ( "✅ Helm chart appVersion updated" ) ;
33+ } else {
34+ console . log ( "✅ Helm chart appVersion is already in sync." ) ;
35+ }
36+ } catch ( error ) {
37+ console . error ( "❌ Error syncing Helm chart version:" , error . message ) ;
38+ process . exit ( 1 ) ;
39+ }
You can’t perform that action at this time.
0 commit comments