Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stage changes to README before the commit #46

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ abstract class Repository extends AsyncOptionalCreatable {

public pushChangesToGit(): void {
const branch = this.getBranchName();
const cmd = `npx git add . && npx git push --set-upstream --no-verify --follow-tags origin ${branch}`;
const cmd = `npx git push --set-upstream --no-verify --follow-tags origin ${branch}`;
this.execCommand(cmd, false);
}

public stageChanges(): void {
this.execCommand('npx git add .', false);
}

public revertUnstagedChanges(): void {
const changedFiles = exec('npx git diff --name-only', { silent: true })
.stdout.split(os.EOL)
Expand Down Expand Up @@ -282,14 +286,19 @@ export class LernaRepo extends Repository {

public prepare(opts: PrepareOpts = {}): void {
const { dryrun, githubRelease } = opts;

this.packages.forEach((pkg) => {
if (pkg.hasScript('version')) {
this.run('version');
this.stageChanges();
}
});

let cmd = 'npx lerna version --conventional-commits --yes --no-commit-hooks --no-push';
if (dryrun) cmd += ' --no-git-tag-version';
if (!dryrun && githubRelease) cmd += ' --create-release github';
if (!dryrun) cmd += ' --message "chore(release): publish [ci skip]"';
this.execCommand(cmd);
this.packages.forEach((pkg) => {
if (pkg.hasScript('version')) this.run('version');
});
if (dryrun) {
this.revertUnstagedChanges();
}
Expand Down Expand Up @@ -420,15 +429,17 @@ export class SinglePackageRepo extends Repository {

public prepare(opts: PrepareOpts = {}): void {
const { dryrun } = opts;

if (this.package.hasScript('version')) {
this.run('version');
this.stageChanges();
}

let cmd =
'npx standard-version --commit-all --releaseCommitMessageFormat="chore(release): {{currentTag}} [ci skip]"';
if (dryrun) cmd += ' --dry-run';
cmd += ` --release-as ${this.nextVersion}`;
this.execCommand(cmd);

if (this.package.hasScript('version')) {
this.run('version');
}
}

public async sign(): Promise<SigningResponse> {
Expand Down