[yoga-0] add update.service.version.ts
This commit is contained in:
17
environment/common/src/update.service.version..ts
Normal file
17
environment/common/src/update.service.version..ts
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
import yaml from 'js-yaml'
|
||||
import fs from 'fs';
|
||||
import dotenv from "dotenv"
|
||||
|
||||
dotenv.config()
|
||||
try {
|
||||
console.log("service updating",process.env.TARGET_FILE,process.env.TARGET_SERVICE,process.env.TARGET_IMAGE);
|
||||
const composeFile: any = yaml.load(fs.readFileSync(process.env.TARGET_FILE as string, 'utf8'));
|
||||
composeFile.services[process.env.TARGET_SERVICE as string].image = process.env.TARGET_IMAGE;
|
||||
const result = yaml.dump(composeFile);
|
||||
fs.writeFileSync(process.env.TARGET_FILE as string, result)
|
||||
console.log("service updated",process.env.TARGET_FILE,process.env.TARGET_SERVICE,process.env.TARGET_IMAGE);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user