Skip to content

Commit

Permalink
fix: publish additional version tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed Sep 6, 2022
1 parent 2922333 commit 2208e9d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
const { major, minor, prerelease } = require("semver");

module.exports = {
branches: ["+([0-9])?(.{+([0-9]),x}).x", "main", "next"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
{
async publishSuccessful(version) {
if (prerelease(version)) {
this.log.info(
"Prerelease version detected; will not add a major version tag."
);
return;
}
const versionTags = [
major(version),
`${major(version)}.${minor(version)}`,
];
for (const v of versionTags) {
this.log.info(`Deleting version tag ${v} from origin.`);
await this.shell.exec(`git push origin :refs/tags/v${v}`);

this.log.info(`Pushing new version tag ${v} to git.`);
await this.shell.exec(`git tag --force v${v}`);
await this.shell.exec(`git push origin v${v}`);
}
},
},
],
};

0 comments on commit 2208e9d

Please sign in to comment.