-
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 #33 from kexa-io/dev
feat: App version auto-update
- Loading branch information
Showing
9 changed files
with
109 additions
and
82 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,51 @@ | ||
name: Update App version | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: dev | ||
|
||
- name: Get latest release of Kexa | ||
uses: rez0n/actions-github-release@794c12f5e8d629e6ca329cf2e2daeb0f0ce6a3ce | ||
id: get_latest_release | ||
with: | ||
token: ${{ secrets.GIT_TOKEN }} | ||
repository: "kexa-io/Kexa" | ||
type: "stable" | ||
|
||
- name: print new latest kexa version | ||
run: echo ${{ steps.get_latest_release.outputs.release }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Run Javascript to update local files | ||
run: | | ||
npm install | ||
node update-app-version.js "${{ steps.get_latest_release.outputs.release }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | ||
|
||
- name: Commit and push changes to dev | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
git add charts/kexa-chart/Chart.yaml | ||
git commit -m "chore(release): update Chart.yaml appversion" | ||
git push origin dev | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
This file was deleted.
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,43 @@ | ||
// YAML TO JSON | ||
// CHANGE APP 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.appVersion = 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}`); |
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