Skip to content

Commit 6578bf2

Browse files
committed
Update publish scripts to auto update SECURITY file
1 parent 59dbc4f commit 6578bf2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

scripts/manual-publish.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const isNotPatch = newMajor !== oldMajor || newMinor !== oldMinor;
5050
const pushCmd = `git add . && git commit -m "Apply changesets and update CHANGELOG" && git push origin ${BRANCH}`;
5151

5252
if (isNotPatch && BRANCH === DEFAULT_BRANCH) {
53+
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
5354
execSync(pushCmd);
5455
/** Create new release branch for every Major or Minor release */
5556
const releaseBranch = `release-${newMajor}.${newMinor}`;

scripts/publish.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const [oldMajor, oldMinor] = LATEST_VERSION.split(".");
3333
const isPatch = newMajor === oldMajor && newMinor === oldMinor;
3434

3535
if (!isPatch) {
36+
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
3637
/** Create new release branch for every Major or Minor release */
3738
const releaseBranch = `release-${newMajor}.${newMinor}`;
3839
execSync(`git checkout -b ${releaseBranch} && git push origin ${releaseBranch}`);

scripts/update-security-md.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { execSync } = require("child_process");
2+
3+
module.exports = (newMajor_minor, oldMajor_minor) => {
4+
/** Update SECURITY.md */
5+
execSync(
6+
`sed -i -e "s/.*| :white_check_mark:.*/| ${newMajor_minor}.x | :white_check_mark: |/" SECURITY.md`,
7+
);
8+
execSync(
9+
`sed -i -e "s/.*| :warning:.*/| ${oldMajor_minor}.x | :warning: |/" SECURITY.md`,
10+
);
11+
execSync(`sed -i -e "s/.*| :x:.*/| < ${oldMajor_minor} | :x: |/" SECURITY.md`);
12+
execSync(
13+
`git add SECURITY.md && git commit -m 'Update SECURITY.md [skip ci]' && git push origin ${process.env.BRANCH}`,
14+
);
15+
};

0 commit comments

Comments
 (0)