build: add semantic release
This commit is contained in:
parent
0eb087ba16
commit
ed5a1bd44f
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"path": "@semantic-release/npm",
|
||||
"npmPublish": true
|
||||
}
|
||||
]
|
||||
}
|
11
package.json
11
package.json
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
"name": "DiawiNodeLoader",
|
||||
"name": "diawi-nodejs-uploader",
|
||||
"version": "0.0.1",
|
||||
"main": "index.js",
|
||||
"author": "Andrey Ponomarenko",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"r": "yarn webpack && node dist/index.js",
|
||||
"build": "yarn tsc && yarn tscpaths -p tsconfig.json -s ./src -o ./dist"
|
||||
"build": "yarn tsc && yarn tscpaths -p tsconfig.json -s ./src -o ./dist",
|
||||
"release": "node scripts/release.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"form-data": "^3.0.0",
|
||||
|
@ -17,6 +18,11 @@
|
|||
"devDependencies": {
|
||||
"@commitlint/cli": "^9.1.2",
|
||||
"@commitlint/config-conventional": "^9.1.2",
|
||||
"@semantic-release/changelog": "^5.0.1",
|
||||
"@semantic-release/commit-analyzer": "^8.0.1",
|
||||
"@semantic-release/git": "^9.0.0",
|
||||
"@semantic-release/npm": "^7.0.6",
|
||||
"@semantic-release/release-notes-generator": "^9.0.1",
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/promise.allsettled": "^1.0.3",
|
||||
|
@ -29,6 +35,7 @@
|
|||
"eslint-plugin-jsx-a11y": "^6.3.1",
|
||||
"eslint-plugin-react": "^7.20.4",
|
||||
"husky": "^4.3.0",
|
||||
"semantic-release": "^17.1.2",
|
||||
"ts-loader": "^8.0.2",
|
||||
"tscpaths": "^0.0.9",
|
||||
"webpack": "^4.44.1",
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const semanticRelease = require('semantic-release');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const result = await semanticRelease({
|
||||
branches: ['master'],
|
||||
repositoryUrl: 'git@github.com:Natteke/diawi-nodejs-uploader.git',
|
||||
});
|
||||
|
||||
if (result) {
|
||||
const { lastRelease, commits, nextRelease, releases } = result;
|
||||
|
||||
console.log(
|
||||
`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`,
|
||||
);
|
||||
|
||||
if (lastRelease.version) {
|
||||
console.log(`The last release was "${lastRelease.version}".`);
|
||||
}
|
||||
|
||||
for (const release of releases) {
|
||||
console.log(`The release was published with plugin "${release.pluginName}".`);
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('No release published.');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('The automated release failed with %O', err);
|
||||
}
|
||||
})();
|
Loading…
Reference in New Issue