diff --git a/.releaserc.json b/.releaserc.json index 23435e7..37e3ba0 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,25 +1,3 @@ { - "branches": ["main", { "name": "beta", "prerelease": true }], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/changelog", - [ - "@semantic-release/git", - { - "assets": ["CHANGELOG.md"] - } - ], - "@semantic-release/github", - "@semantic-release/npm", - [ - "@semantic-release/exec", - { - "verifyConditionsCmd": "echo //npm.pkg.github.com/:_authToken=${process.env.GITHUB_TOKEN} > /tmp/github.npmrc && npm whoami --userconfig /tmp/github.npmrc --registry https://npm.pkg.github.com/", - "publishCmd": "npm publish --userconfig /tmp/github.npmrc --tag ${nextRelease.channel} --registry https://npm.pkg.github.com/ --no-git-tag-version", - "successCmd": "rm /tmp/github.npmrc", - "failCmd": "rm /tmp/github.npmrc" - } - ] - ] + "extends": "./semantic-release/base.js" } diff --git a/package.json b/package.json index a2fa391..4c2bc8d 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "./eslint/styles/prefer-array-shorthand": "./eslint/styles/prefer-array-shorthand.js", "./eslint/styles/prefer-interface": "./eslint/styles/prefer-interface.js", "./prettier": "./prettier/base.js", + "./semantic-release": "./semantic-release/base.js", "./typescript": "./typescript/base.js" }, "files": [ diff --git a/semantic-release/base.js b/semantic-release/base.js new file mode 100644 index 0000000..535a374 --- /dev/null +++ b/semantic-release/base.js @@ -0,0 +1,38 @@ +export default { + branches: ["main", { name: "beta", prerelease: true }], + plugins: [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/git", + { + assets: ["CHANGELOG.md"], + }, + ], + [ + "@semantic-release/npm", + { + tarballDir: ".semantic-release", + }, + ], + [ + "@semantic-release/github", + { + assets: ".semantic-release/*.tgz", + }, + ], + [ + "@semantic-release/exec", + { + verifyConditionsCmd: + 'echo "registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${process.env.GITHUB_TOKEN}" > /tmp/github.npmrc && npm whoami --userconfig /tmp/github.npmrc', + prepareCmd: "npx -y prettier --write CHANGELOG.md", + publishCmd: + "npm publish --userconfig /tmp/github.npmrc --tag ${nextRelease.channel} --no-git-tag-version", + successCmd: "rm /tmp/github.npmrc", + failCmd: "rm /tmp/github.npmrc", + }, + ], + ], +};