-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from kexa-io/dev
fix: versioning workflow semantic + helm releaser
- Loading branch information
Showing
7 changed files
with
116 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Release Workflow (Semantic + Helm) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
semantic-release: | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Prep plugins | ||
run: | | ||
npm install -D @semantic-release/changelog @semantic-release/git @semantic-release/exec | ||
- name: Run semantic release | ||
id: ver | ||
run: npx semantic-release | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
helm-release: | ||
needs: semantic-release | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Helm | ||
run: | | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add grafana https://grafana.github.io/helm-charts | ||
helm repo update | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
config: "cr.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,6 @@ name: Release Charts | |
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
apiVersion: v2 | ||
name: "helm-kexa-grafana-postgres" | ||
name: helm-kexa-grafana-postgres | ||
description: A Helm chart that installs PostgreSQL and Grafana | ||
version: 1.4.0 | ||
appVersion: "1.0" | ||
appVersion: '1.0' | ||
icon: https://kexa.io/kexa-no-background-color.png | ||
|
||
dependencies: | ||
- name: postgresql | ||
version: 15.0.0 | ||
repository: "https://charts.bitnami.com/bitnami" | ||
repository: https://charts.bitnami.com/bitnami | ||
- name: grafana | ||
version: 8.5.1 | ||
repository: "https://grafana.github.io/helm-charts" | ||
repository: https://grafana.github.io/helm-charts |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// YAML TO JSON | ||
// CHANGE VERSION | ||
// THEN JSON TO YAML AND WRITE TO FILE | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const yaml = require('js-yaml'); | ||
|
||
const newVersion = process.argv[2]; | ||
if (!newVersion) { | ||
console.error('Error: No version specified.'); | ||
process.exit(1); | ||
} | ||
|
||
const chartFilePath = 'charts/kexa-chart/Chart.yaml'; | ||
|
||
if (!fs.existsSync(chartFilePath)) { | ||
console.error(`Error: ${chartFilePath} not found.`); | ||
process.exit(1); | ||
} | ||
|
||
let fileContent = fs.readFileSync(chartFilePath, 'utf8'); | ||
let chartData; | ||
|
||
try { | ||
chartData = yaml.load(fileContent); | ||
} catch (e) { | ||
console.error('Error parsing YAML:', e); | ||
process.exit(1); | ||
} | ||
|
||
if (chartData.version) { | ||
chartData.version = newVersion; | ||
console.log(`Updating version to ${newVersion}`); | ||
} else { | ||
console.error('Version field not found in Chart.yaml.'); | ||
process.exit(1); | ||
} | ||
|
||
const updatedYaml = yaml.dump(chartData); | ||
fs.writeFileSync(chartFilePath, updatedYaml, 'utf8'); | ||
console.log(`Updated ${chartFilePath} to version ${newVersion}`); |