Skip to content

Commit

Permalink
fix: Reenable full publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Jun 17, 2024
1 parent 24c14ce commit 1e2776d
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@ try {
} catch {
// empty
}
// try {
// execSync("pnpm changeset version");
// execSync(
// `git add . && git commit -m "Apply changesets and update CHANGELOG" && git push origin ${process.env.BRANCH}`,
// );
// } catch {
// // no changesets to be applied
// }
try {
execSync("pnpm changeset version");
execSync(
`git add . && git commit -m "Apply changesets and update CHANGELOG" && git push origin ${process.env.BRANCH}`,
);
} catch {
// no changesets to be applied
}

// const { version: VERSION, name } = require("../lib/package.json");
// let LATEST_VERSION = "0.0.-1";
const { version: VERSION, name } = require("../lib/package.json");
let LATEST_VERSION = "0.0.-1";

// try {
// LATEST_VERSION = execSync(`npm view ${name} version`).toString() ?? "0.0.-1";
// } catch {
// // empty
// }
try {
LATEST_VERSION = execSync(`npm view ${name} version`).toString() ?? "0.0.-1";
} catch {
// empty
}

// console.log({ VERSION, LATEST_VERSION });
console.log({ VERSION, LATEST_VERSION });

// const [newMajor, newMinor] = VERSION.split(".");
// const [oldMajor, oldMinor] = LATEST_VERSION.split(".");
const [newMajor, newMinor] = VERSION.split(".");
const [oldMajor, oldMinor] = LATEST_VERSION.split(".");

// const isPatch = newMajor === oldMajor && newMinor === oldMinor;
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}`);
// }
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}`);
}

/** Create release */
execSync("cd lib && pnpm build");
execSync("cd lib && pnpm build && npm publish --provenance --access public");

/** Create GitHub release */
// execSync(
// `gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`,
// );
execSync(
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`,
);

// Publish canonical packages
[
Expand Down

0 comments on commit 1e2776d

Please sign in to comment.