mirror of
https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension.git
synced 2024-11-22 08:03:49 +00:00
fix: create-release-script
This commit is contained in:
parent
6e4567d2cf
commit
bb966b603c
@ -6,8 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"release": "yarn config set version-tag-prefix brave-detection-blocker@v && yarn config set version-git-message 'brave-detection-blocker@v%s' && yarn version --patch && yarn postversion",
|
"release": "yarn config set version-tag-prefix brave-detection-blocker@v && yarn config set version-git-message 'brave-detection-blocker@v%s' && yarn version --patch && yarn postversion",
|
||||||
"postversion": "git push && git push --tags",
|
"postversion": "git push",
|
||||||
"pub": "yarn release && node ./scripts/create-release.js"
|
"pub": "node ./scripts/create-release.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const archiver = require('archiver');
|
const archiver = require('archiver');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
async function ghRelease(changes) {
|
async function ghRelease(changes) {
|
||||||
const package = JSON.parse(fs.readFileSync('package.json'));
|
const package = JSON.parse(fs.readFileSync('package.json'));
|
||||||
@ -20,31 +21,36 @@ async function ghRelease(changes) {
|
|||||||
filePipes.forEach((file) => {
|
filePipes.forEach((file) => {
|
||||||
arch = arch.file(file, { name: file });
|
arch = arch.file(file, { name: file });
|
||||||
});
|
});
|
||||||
arch.on('error', (err) => reject(err)).pipe(stream);
|
arch.on('error', (err) => reject(err)).pipe(outputZip);
|
||||||
|
|
||||||
stream.on('close', () => resolve());
|
outputZip.on('close', () => resolve());
|
||||||
arch.finalize();
|
arch.finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
const changeLogPath = `releases/${package.version}-changeLog.md`;
|
const changeLogPath = `releases/${package.version}.changelog.md`;
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
changeLogPath,
|
changeLogPath,
|
||||||
`# ${package.version} \n\n
|
`# ${package.version} \n
|
||||||
${changes.reduce((acc, change) => {
|
${changes.reduce((acc, change) => {
|
||||||
return acc + `- ${change}\n`;
|
return acc + `- ${change}\n`;
|
||||||
}, '')}`,
|
}, '')}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
const p = spawn('gh', ['release', `create v${package.version} '${outputPath}' -F ${changeLogPath}`]);
|
const p = spawn('gh', ['release', 'create', `v${package.version}`, `./${outputPath}`, '-F', `./${changeLogPath}`], {
|
||||||
|
shell: true,
|
||||||
|
});
|
||||||
|
// const p = spawn('pwd');
|
||||||
let result = '';
|
let result = '';
|
||||||
p.stdout.on('data', (data) => (result += data.toString()));
|
p.stdout.on('data', (data) => (result += data.toString()));
|
||||||
p.stderr.on('data', (data) => (result += data.toString()));
|
p.stderr.on('data', (data) => (result += data.toString()));
|
||||||
p.on('close', () => {
|
p.on('close', () => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
@ -53,6 +59,6 @@ async function ghRelease(changes) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const changes = process.argv[2].split(',');
|
const changes = process.argv[2].split(',');
|
||||||
// ghRelease(changes)
|
await ghRelease(changes);
|
||||||
console.log('Release created', changes);
|
console.log('Release created', changes);
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user