forked from unimatrix/web
DUNE-002: add validated patchnote publishing system
This commit is contained in:
parent
89acb004d3
commit
d955e8beb8
1 changed files with 155 additions and 25 deletions
4
website/scripts/manage-patchnotes.mjs
Normal file
4
website/scripts/manage-patchnotes.mjs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import {readFileSync,writeFileSync} from 'node:fs';import {makeRelease,makeBugfix,validatePatchnotes} from './patchnote-policy.mjs';
|
||||
const root=new URL('./',import.meta.url),read=name=>JSON.parse(readFileSync(new URL(name,root),'utf8'));
|
||||
const register=read('task-register.json'),pending=read('pending-patchnotes.json'),releases=read('changelog.json'),action=process.argv[2]||'validate';
|
||||
try{if(action==='validate'){validatePatchnotes(register,pending,releases);console.log('Patchnote registry valid. '+pending.completed.length+'/5 normal tasks pending; '+releases.length+' releases.')}else{if(!['publish','bugfix'].includes(action))throw Error('Use validate, publish or bugfix');const input=JSON.parse(readFileSync(0,'utf8'));const next=action==='publish'?makeRelease(register,pending,releases,input):makeBugfix(register,pending,releases,input);for(const [file,data]of [['task-register.json',next.register],['pending-patchnotes.json',next.pending],['changelog.json',next.releases]])writeFileSync(new URL(file,root),JSON.stringify(data,null,2)+'\n');console.log('Release recorded: '+next.release.version+'. Run the website build and normal publication workflow.')}}catch(error){console.error(error.message);process.exitCode=1}
|
||||
Loading…
Reference in a new issue

Staff