Skip to content

Commit

Permalink
Update publish scripts to auto update SECURITY file
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Jun 13, 2024
1 parent 59dbc4f commit 6578bf2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/manual-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const isNotPatch = newMajor !== oldMajor || newMinor !== oldMinor;
const pushCmd = `git add . && git commit -m "Apply changesets and update CHANGELOG" && git push origin ${BRANCH}`;

if (isNotPatch && BRANCH === DEFAULT_BRANCH) {
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
execSync(pushCmd);
/** Create new release branch for every Major or Minor release */
const releaseBranch = `release-${newMajor}.${newMinor}`;
Expand Down
1 change: 1 addition & 0 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const [oldMajor, oldMinor] = LATEST_VERSION.split(".");
const isPatch = newMajor === oldMajor && newMinor === oldMinor;

if (!isPatch) {
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
/** Create new release branch for every Major or Minor release */
const releaseBranch = `release-${newMajor}.${newMinor}`;
execSync(`git checkout -b ${releaseBranch} && git push origin ${releaseBranch}`);
Expand Down
15 changes: 15 additions & 0 deletions scripts/update-security-md.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { execSync } = require("child_process");

module.exports = (newMajor_minor, oldMajor_minor) => {
/** Update SECURITY.md */
execSync(
`sed -i -e "s/.*| :white_check_mark:.*/| ${newMajor_minor}.x | :white_check_mark: |/" SECURITY.md`,
);
execSync(
`sed -i -e "s/.*| :warning:.*/| ${oldMajor_minor}.x | :warning: |/" SECURITY.md`,
);
execSync(`sed -i -e "s/.*| :x:.*/| < ${oldMajor_minor} | :x: |/" SECURITY.md`);
execSync(
`git add SECURITY.md && git commit -m 'Update SECURITY.md [skip ci]' && git push origin ${process.env.BRANCH}`,
);
};

0 comments on commit 6578bf2

Please sign in to comment.