From bc8ecc255f37dd72b5dc2ddc25ec8b903e0bb2e9 Mon Sep 17 00:00:00 2001 From: dmvict Date: Wed, 21 Jun 2023 10:38:00 +0300 Subject: [PATCH] Update step `action.write`, use js code run instead of shell execution, update willfile --- step/ActionWrite.s | 34 ++++++++++++++++++++++++++++++++++ will.yml | 8 ++------ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 step/ActionWrite.s diff --git a/step/ActionWrite.s b/step/ActionWrite.s new file mode 100644 index 00000000..224337e3 --- /dev/null +++ b/step/ActionWrite.s @@ -0,0 +1,34 @@ + +function actionWrite( frame ) +{ + const run = frame.run; + const module = run.module; + const will = module.will; + const fileProvider = will.fileProvider; + const logger = will.transaction.logger; + const opener = module.toOpener(); + + /* */ + + logger.log( `Updating willfile. Setup version "${ module.about.version }".` ); + + const commonPath = fileProvider.path.common( opener.openedModule.willfilesPath ); + will.willfilePropertySet + ({ + commonPath, + request: '', + selectorsMap: { 'about/version' : module.about.version }, + }); + + /* */ + + const actionPath = fileProvider.path.join( module.dirPath, 'action.yml' ); + const action = fileProvider.fileReadUnknown( actionPath ); + action.runs.steps[ 0 ].uses = `Wandalen/wretry.action@v${ module.about.version }_js_action`; + + logger.log( `Updating action. Setup used action version to "Wandalen/wretry.action@v${ module.about.version }_js_action".` ); + + fileProvider.fileWrite({ filePath : actionPath, data : action, encoding : 'yaml' }); +} + +module.exports = actionWrite; diff --git a/will.yml b/will.yml index a8e97aa2..e0d0c604 100644 --- a/will.yml +++ b/will.yml @@ -281,8 +281,6 @@ step: - proto npm.install: shell: npm install --production - npm.install.dev: - shell: npm install wFiles clean.out: inherit: files.delete filePath: '{path::out.*=1}/source' @@ -368,8 +366,8 @@ step: inherit: git.push dirPath: . action.write: - currentPath: 'path::in' - shell: 'node {path::step}/ActionWrite.s version:{about::version} logger:3' + inherit: js.run + js: '{path::step}/ActionWrite.s' release: inherit: repo.release tag: 'v{about::version}' @@ -393,7 +391,6 @@ build: - tag.js_action - push - switch.master - - npm.install.dev - action.write - add - commit @@ -422,7 +419,6 @@ build: - tag.js_action - push - switch.master - - npm.install.dev - action.write - add - commit