Skip to content

Commit

Permalink
chore: add patch logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaringe committed Mar 24, 2021
1 parent df97b41 commit 7d10f8a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .rad/tasks/patch-install-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const task: Task = {
const nextVersion = Deno.env.get("NEXT_VERSION");
if (!nextVersion) throw new Error("NEXT_VERSION not found");
const installScriptRelativeFilename = "assets/install.sh";
const readmeFilename = "readme.md";
const oldContent = await fs.readFile(installScriptRelativeFilename);
const nextContent = oldContent.replace(
/__RAD_VERSION__=.*/g,
Expand All @@ -13,15 +14,21 @@ export const task: Task = {
if (oldContent === nextContent) {
throw new Error("failed to update install version");
}
logger.info(
`updated ${installScriptRelativeFilename}, patched for next version: ${nextVersion}`,
);
logger.info(nextContent);
const oldReadmeContent = await fs.readFile("readme.md");
const oldReadmeContent = await fs.readFile(readmeFilename);
const nextReadmeContent = oldReadmeContent.replace(
/rad\/releases\/download\/v\d+.\d+.\d+/g,
`rad/releases/download/v${nextVersion}`,
);
logger.info(
`updated ${readmeFilename}, patched for next version: ${nextVersion}`,
);
await Promise.all([
Deno.writeTextFile(installScriptRelativeFilename, nextContent),
Deno.writeTextFile("readme.md", nextReadmeContent),
Deno.writeTextFile(readmeFilename, nextReadmeContent),
]);
},
};

0 comments on commit 7d10f8a

Please sign in to comment.