@dbx-tools/projen 0.6.230 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -194,6 +194,11 @@ archive content and repository identity, PyPI uses hash-aware existing-file
194
194
  behavior, Cargo checks existing versions, and GitHub assets upload to the
195
195
  component release.
196
196
 
197
+ Set `releaseSyncBranch` when a repository retains a long-lived source branch.
198
+ After publication the workflow fast-forwards that branch only when it exists
199
+ and is an ancestor of released `main`; missing or diverged branches are left
200
+ untouched.
201
+
197
202
  The Rust matrix has one row per target. Each row installs native dependencies,
198
203
  builds the Cargo workspace once, then packages every discovered output from
199
204
  that shared build. Set a source-only crate's or
package/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/projen";
6
- export const PACKAGE_VERSION = "0.6.230";
6
+ export const PACKAGE_VERSION = "0.7.0";
7
7
  export * as barrels from "./src/barrels.ts";
8
8
  export * as bunApp from "./src/bun-app.ts";
9
9
  export * as bunWorkflow from "./src/bun-workflow.ts";
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "main": "index.ts",
52
52
  "license": "Apache-2.0",
53
- "version": "0.6.230",
53
+ "version": "0.7.0",
54
54
  "types": "index.ts",
55
55
  "type": "module",
56
56
  "exports": {
package/src/project-js.ts CHANGED
@@ -634,6 +634,8 @@ export type DBXToolsJavaScriptProjectOptions = CommonProjectOptions &
634
634
  readonly releaseValidationTasks?: readonly string[];
635
635
  /** Optional AI-generated release summary. Defaults to enabled. */
636
636
  readonly releaseSummary?: boolean | ReleaseSummaryOptions;
637
+ /** Existing source branch safely fast-forwarded after an independent release. */
638
+ readonly releaseSyncBranch?: string | false;
637
639
  /** Set to `false` to omit normal npm workspace publication. */
638
640
  readonly nodeRelease?: boolean;
639
641
  /** Unified dbx-tools release workflow, or no release surface. Defaults to `dbx-tools`. */
@@ -1601,6 +1603,7 @@ function initProject(
1601
1603
  pythonRoot: options.releasePythonRoot,
1602
1604
  validationTasks: options.releaseValidationTasks,
1603
1605
  summary: options.releaseSummary,
1606
+ syncBranch: options.releaseSyncBranch,
1604
1607
  });
1605
1608
  }
1606
1609
  }
package/src/release.ts CHANGED
@@ -56,6 +56,12 @@ export interface DBXToolsReleaseOptions {
56
56
  readonly pythonRoot?: string;
57
57
  /** Repository task names run in the release worktree before expensive validation and publication. */
58
58
  readonly validationTasks?: readonly string[];
59
+ /**
60
+ * Existing source branch safely fast-forwarded after publication.
61
+ *
62
+ * Missing or diverged branches are left untouched.
63
+ */
64
+ readonly syncBranch?: string | false;
59
65
  /**
60
66
  * Generate a versioned release summary locally. Defaults to enabled with the
61
67
  * standard Cursor, Codex, Claude fallback order.
@@ -617,6 +623,39 @@ function addIndependentDocsJobs(
617
623
  });
618
624
  }
619
625
 
626
+ function addIndependentBranchSyncJob(workflow: GithubWorkflow, branch: string): void {
627
+ workflow.addJob("sync-release-branch", {
628
+ if: "${{ github.event_name == 'push' && needs.publication-complete.result == 'success' }}",
629
+ needs: ["publication-complete"],
630
+ runsOn: ["ubuntu-latest"],
631
+ permissions: { contents: JobPermission.WRITE },
632
+ steps: [
633
+ {
634
+ name: "Checkout released main",
635
+ uses: "actions/checkout@v6",
636
+ with: { "fetch-depth": 0 },
637
+ },
638
+ {
639
+ name: `Safely fast-forward ${branch}`,
640
+ shell: "bash",
641
+ env: { SOURCE_BRANCH: branch },
642
+ run: [
643
+ 'if ! git ls-remote --exit-code --heads origin "refs/heads/$SOURCE_BRANCH" >/dev/null 2>&1; then',
644
+ ' echo "source branch $SOURCE_BRANCH no longer exists; nothing to sync"',
645
+ " exit 0",
646
+ "fi",
647
+ 'git fetch origin "refs/heads/$SOURCE_BRANCH:refs/remotes/origin/$SOURCE_BRANCH"',
648
+ 'if git merge-base --is-ancestor "origin/$SOURCE_BRANCH" HEAD; then',
649
+ ' git push origin "HEAD:refs/heads/$SOURCE_BRANCH"',
650
+ "else",
651
+ ' echo "::warning::source branch $SOURCE_BRANCH diverged from released main; leaving it untouched"',
652
+ "fi",
653
+ ].join("\n"),
654
+ },
655
+ ],
656
+ });
657
+ }
658
+
620
659
  class IndependentReleaseFinalizer extends Component {
621
660
  private finalized = false;
622
661
 
@@ -624,6 +663,7 @@ class IndependentReleaseFinalizer extends Component {
624
663
  project: DBXToolsJavaScriptProject,
625
664
  private readonly workflow: GithubWorkflow,
626
665
  private readonly docs: ReleaseDocsOptions | undefined,
666
+ private readonly syncBranch: string | undefined,
627
667
  ) {
628
668
  super(project);
629
669
  }
@@ -645,6 +685,9 @@ class IndependentReleaseFinalizer extends Component {
645
685
  if (this.docs) {
646
686
  addIndependentDocsJobs(this.workflow, this.project as DBXToolsJavaScriptProject, this.docs);
647
687
  }
688
+ if (this.syncBranch) {
689
+ addIndependentBranchSyncJob(this.workflow, this.syncBranch);
690
+ }
648
691
  }
649
692
  }
650
693
 
@@ -713,7 +756,7 @@ function configureIndependentRelease(
713
756
  workflow.addJob("publish-node", independentNodePublishJob(project));
714
757
  registerIndependentPublicationJob(workflow, "publish-node");
715
758
  }
716
- new IndependentReleaseFinalizer(project, workflow, options.docs);
759
+ new IndependentReleaseFinalizer(project, workflow, options.docs, options.syncBranch || undefined);
717
760
  releaseWorkflows.set(project, workflow);
718
761
  }
719
762