-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improving relase routine (#1422)
- Loading branch information
Showing
2 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
import { execSync } from 'child_process'; | ||
import { error } from 'console'; | ||
|
||
(() => { | ||
// Commit versions generated at pre-build step | ||
execSync(`pnpm -C packages/versions prebuild`); | ||
execSync(`git add packages/versions/src/lib/getBuiltinVersions.ts`); | ||
execSync(`git commit -m"ci(scripts): update versions"`); | ||
try { | ||
// Invoke versions' prebuild script (will rewrite version files if needed) | ||
execSync(`pnpm -C packages/versions prebuild`); | ||
|
||
// run changeset version | ||
execSync(`changeset version`); | ||
// Checks git status | ||
const isGitClean = !execSync(`git status --porcelain`).toString().trim(); | ||
|
||
// Skip adding/committing/releasing stuff if there's nothing new | ||
if (!isGitClean) { | ||
execSync(`git add packages/versions/src/lib/getBuiltinVersions.ts`); | ||
execSync(`git commit -m"ci(scripts): update versions"`); | ||
|
||
// Run changeset version | ||
execSync(`changeset version`); | ||
} | ||
} catch (err) { | ||
error(err.toString()); | ||
} | ||
})(); |