Change version and commit changes

Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com>
This commit is contained in:
Shakar
2023-09-17 16:49:51 +03:00
parent fb31fa8b7f
commit 36fbfe3356
2 changed files with 88 additions and 2 deletions

View File

@@ -1,13 +1,14 @@
const core = require('@actions/core')
const github = require('@actions/github')
const fs = require('fs')
const xml2js = require('xml2js')
import commitChanges from './commit.js';
try {
console.log(`CWD: ${process.cwd()}`)
const label = core.getInput('label');
const filePath = `${process.cwd()}/${core.getInput('filePath')}`;
console.log(`Label: ${label}`)
console.log(`File path: ${filePath}`)
@@ -18,7 +19,8 @@ try {
// else if (project == 'nodejs')
// filePath = `${filePath}/package.json`;
const version = require(filePath).version;
const packageJson = require(filePath);
const version = packageJson.version;
// the version is in semantic format, so we can split it by dot
@@ -46,7 +48,10 @@ try {
console.log(`Old version: ${version}. New version: ${newVersion}`)
packageJson.version = newVersion;
fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2));
commitChanges();
const payload = JSON.stringify(github.context.payload, undefined, 2)
// console.log(`The event payload: ${payload}`);