build: fix versioning

This commit is contained in:
2024-01-31 23:42:32 +02:00
committed by Chen Asraf
parent 81dd6e3b19
commit 6c7e3e5068
2 changed files with 44 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "simple-scaffold",
"version": "0.0.0",
"version": "1.9.0",
"description": "Generate any file structure - from single components to entire app boilerplates, with a single command.",
"homepage": "https://chenasraf.github.io/simple-scaffold",
"repository": "https://github.com/chenasraf/simple-scaffold.git",

View File

@@ -1,30 +1,34 @@
/** @type {import('semantic-release').Options} */
const ref = process.env.GITHUB_REF || ""
const branch = ref.split("/").pop()
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: ["master", { name: "pre", prerelease: true }],
analyzeCommits: {
path: "semantic-release-conventional-commits",
},
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
"@semantic-release/npm",
{
changelogFile: "CHANGELOG.md",
changelogTitle: "# Change Log",
// only update the pkg version on root, don't publish
npmPublish: false,
},
],
// [
// '@semantic-release/npm',
// {
// // only update the pkg version on doc, don't publish
// npmPublish: false,
// pkgRoot: 'doc',
// },
// ]
[
"@semantic-release/npm",
{
npmPublish: true,
pkgRoot: "dist",
},
],
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md"],
// publish from build dir instead of root
pkgRoot: "build",
},
],
[
@@ -33,5 +37,29 @@ module.exports = {
assets: ["*.tgz"],
},
],
[
"@semantic-release/git",
{
assets: ["package.json", "CHANGELOG.md"].filter(Boolean),
},
],
//
// [
// '@semantic-release/exec',
// {
// verifyReleaseCmd: 'echo ${nextRelease.version} > .VERSION',
// },
// ],
],
}
if (branch === "master") {
const gitIdx = module.exports.plugins.findIndex((plugin) => plugin[0] === "@semantic-release/git")
module.exports.plugins.splice(gitIdx, 0, [
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
changelogTitle: "# Change Log",
},
])
}