-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathreleaseDocs.ts
32 lines (26 loc) · 1.08 KB
/
releaseDocs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import fs from 'fs';
import { resolve } from 'path';
import { runCommand } from './common';
const pathLib = resolve(__dirname, '../docs');
async function prepareCoreRelease() {
try {
// Check if the current branch is clean (no staged changes)
runCommand(
'git diff-index --quiet HEAD --',
'You have uncommitted changes. Please commit or stash them before running the release script.',
);
// Increment the docs version
runCommand(`pnpm --filter @grapesjs/docs exec npm version patch --no-git-tag-version --no-commit-hooks`);
// Create a new release branch
const newVersion = JSON.parse(fs.readFileSync(`${pathLib}/package.json`, 'utf8')).version;
const newBranch = `release-docs-v${newVersion}`;
runCommand(`git checkout -b ${newBranch}`);
runCommand('git add .');
runCommand(`git commit -m "Release GrapesJS docs: v${newVersion}"`);
console.log(`Release prepared! Push the current "${newBranch}" branch and open a new PR targeting 'dev'`);
} catch (error) {
console.error(error);
process.exit(1);
}
}
prepareCoreRelease();