Skip to content

Commit

Permalink
feat: Added push changelogs options for features (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: Joost van der Waal <[email protected]>
  • Loading branch information
joostvdwsd and Joost van der Waal authored Jun 27, 2024
1 parent 6d05d4c commit d5e1e7c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitversion.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { S3Publish } = require('@cp-utils/gitversion-s3publish');

module.exports = defineConfig({
independentVersioning: false,
featureBumpBehavior: 'always',
featureBumpBehavior: 'always',
plugins: [
new S3Publish({
bucketName: 'www-cputils-com-website-docspublishbucket31a61f6d-pixklxvi0wye',
Expand Down
4 changes: 3 additions & 1 deletion workspaces/packages/gitversion/src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export class PublishCommand extends GitVersionCommand {
}

await this.updateChangelogs(packedPackages, project, git, logger);
if (this.push) {
const isDefaultChangelogBranch = application.branch.type !== BranchType.FEATURE;
const shouldPushChangelogs = this.push && (isDefaultChangelogBranch || configuration.options.featurePushChangelogs);
if (shouldPushChangelogs) {
await git.push();
} else {
logger.reportInfo('Skipping push step');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const defaultConfig: Required<BaseConfigurationOptions> = {
versionTagPrefix: 'v',
dryRun: false,
featureBumpBehavior: 'never',
featurePushChangelogs: false,
gitFlags: {},
};

Expand Down
1 change: 1 addition & 0 deletions workspaces/packages/gitversion/src/core/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const isBaseConfigurationOptions = t.isPartial({
versionTagPrefix: t.isOptional(t.isString()),
dryRun: t.isOptional(t.isBoolean()),
featureBumpBehavior: t.isOptional(t.isEnum(FeatureBumpBehaviorItems)),
featurePushChangelogs: t.isOptional(t.isBoolean()),
gitFlags: t.isOptional(t.isRecord(t.isString())),
});

Expand Down
1 change: 1 addition & 0 deletions workspaces/packages/gitversion/src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export const DEFAULT_CONFIGURATION_OPTIONS: RequiredConfigurationOption = {
versionTagPrefix: 'v',
dryRun: false,
featureBumpBehavior: 'never',
featurePushChangelogs: false,
gitFlags: {},
};

0 comments on commit d5e1e7c

Please sign in to comment.