@dbx-tools/projen 0.9.68 → 0.9.70

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
@@ -490,8 +490,9 @@ bun run release --release-notes-instructions "Focus on operator-visible changes.
490
490
 
491
491
  `--demo-deploy` is off by default. After tagging and any local registry
492
492
  publication it runs `bun run demo:deploy`, which stages the AppKit demo
493
- and deploys it to the FEVM workspace. That step is local only and is not
494
- recorded in the annotated tag.
493
+ from locally compiled Node packages and locally built Python wheels, resolves
494
+ the configured/default workspace profile through `@dbx-tools/auth`, and deploys
495
+ it. That step is local only and is not recorded in the annotated tag.
495
496
 
496
497
  After bump and configured validation, release writes
497
498
  `docs/releases/vX.Y.Z.md` with `dbx genie exec -C "$PWD" --sandbox read-only
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.9.68";
6
+ export const PACKAGE_VERSION = "0.9.70";
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
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@clack/prompts": "^1.7.0",
33
- "@dbx-tools/core": "^0.9.68",
34
- "@dbx-tools/path": "^0.9.68",
35
- "@dbx-tools/shared-core": "^0.9.68",
33
+ "@dbx-tools/core": "^0.9.70",
34
+ "@dbx-tools/path": "^0.9.70",
35
+ "@dbx-tools/shared-core": "^0.9.70",
36
36
  "commander": "^15.0.0",
37
37
  "concurrently": "^10.0.3",
38
38
  "constructs": "^10.6.0",
@@ -54,11 +54,12 @@
54
54
  },
55
55
  "main": "index.ts",
56
56
  "license": "Apache-2.0",
57
- "version": "0.9.68",
57
+ "version": "0.9.70",
58
58
  "types": "index.ts",
59
59
  "type": "module",
60
60
  "exports": {
61
61
  ".": "./index.ts",
62
+ "./python-release-packaging": "./tasks/publish-python.ts",
62
63
  "./release-packaging": "./tasks/publish-npm.ts",
63
64
  "./package.json": "./package.json"
64
65
  },
package/tasks/release.ts CHANGED
@@ -41,6 +41,116 @@ function assertAncestor(root: string, ancestor: string, descendant: string, mess
41
41
  }
42
42
  }
43
43
 
44
+ /** Replace the local annotated tag object with the tag object created on the remote. */
45
+ export function refreshReleaseTagFromRemote(options: {
46
+ readonly expectedObject: string;
47
+ readonly remote: string;
48
+ readonly root: string;
49
+ readonly tag: string;
50
+ }): void {
51
+ const { expectedObject, remote, root, tag } = options;
52
+ const ref = `refs/tags/${tag}`;
53
+ runTaskCommand(root, "git", ["fetch", "--force", remote, `${ref}:${ref}`]);
54
+ const localObject = captureTaskCommand(root, "git", ["rev-parse", ref], { check: true });
55
+ if (localObject !== expectedObject) {
56
+ throw new Error(
57
+ `remote ${tag} resolved to ${localObject || "<empty>"}, expected ${expectedObject}`,
58
+ );
59
+ }
60
+ }
61
+
62
+ function pushAnnotatedReleaseTag(options: {
63
+ readonly annotation: string;
64
+ readonly branch: string;
65
+ readonly head: string;
66
+ readonly remote: string;
67
+ readonly root: string;
68
+ readonly tag: string;
69
+ }): void {
70
+ const { annotation, branch, head, remote, root, tag } = options;
71
+ runTaskCommand(root, "git", ["tag", "--annotate", tag, "--message", annotation]);
72
+ const githubAccount = projectUtils.resolveProjectGhAccount(root, { remote });
73
+ if (!githubAccount) {
74
+ logger.warn("no authenticated GitHub account can access the release repository; using git push");
75
+ runTaskCommand(root, "git", ["push", remote, `refs/tags/${tag}`]);
76
+ return;
77
+ }
78
+
79
+ const remoteBranch = captureTaskCommand(
80
+ root,
81
+ "git",
82
+ ["ls-remote", remote, `refs/heads/${branch}`],
83
+ { check: true },
84
+ )
85
+ .split(/\s+/)[0]
86
+ ?.trim();
87
+ if (remoteBranch !== head) {
88
+ throw new Error(
89
+ `cannot tag ${githubAccount.remote.repository}: ${remote}/${branch} does not equal local HEAD`,
90
+ );
91
+ }
92
+ let remoteRefCreated = false;
93
+ try {
94
+ const tagObject = captureTaskCommand(
95
+ root,
96
+ "gh",
97
+ [
98
+ "api",
99
+ "--hostname",
100
+ githubAccount.host,
101
+ "--method",
102
+ "POST",
103
+ `repos/${githubAccount.remote.repository}/git/tags`,
104
+ "-f",
105
+ `tag=${tag}`,
106
+ "-f",
107
+ `message=${annotation}`,
108
+ "-f",
109
+ `object=${head}`,
110
+ "-f",
111
+ "type=commit",
112
+ "--jq",
113
+ ".sha",
114
+ ],
115
+ { check: true, env: githubAccount.env, stderr: "inherit" },
116
+ );
117
+ if (!tagObject) throw new Error(`GitHub did not return an annotated tag object for ${tag}`);
118
+ runTaskCommand(
119
+ root,
120
+ "gh",
121
+ [
122
+ "api",
123
+ "--hostname",
124
+ githubAccount.host,
125
+ "--method",
126
+ "POST",
127
+ `repos/${githubAccount.remote.repository}/git/refs`,
128
+ "-f",
129
+ `ref=refs/tags/${tag}`,
130
+ "-f",
131
+ `sha=${tagObject}`,
132
+ "--silent",
133
+ ],
134
+ { env: githubAccount.env },
135
+ );
136
+ remoteRefCreated = true;
137
+ refreshReleaseTagFromRemote({ expectedObject: tagObject, remote, root, tag });
138
+ logger.info(`created ${tag} through the GitHub API`, {
139
+ account: githubAccount.login,
140
+ host: githubAccount.host,
141
+ repository: githubAccount.remote.repository,
142
+ sha: head,
143
+ });
144
+ } catch (error) {
145
+ if (remoteRefCreated) throw error;
146
+ logger.warn("GitHub API tag creation failed; using git push", {
147
+ error,
148
+ repository: githubAccount.remote.repository,
149
+ });
150
+ runTaskCommand(root, "git", ["push", remote, `refs/tags/${tag}`]);
151
+ }
152
+ }
153
+
44
154
  function prepareReleaseBranch(options: {
45
155
  readonly branch: string;
46
156
  readonly remote: string;
@@ -191,17 +301,19 @@ export async function runRelease(
191
301
  }
192
302
 
193
303
  runTaskCommand(root, "git", ["push", remote, `HEAD:${branch}`]);
194
- runTaskCommand(root, "git", [
195
- "tag",
196
- "--annotate",
197
- tag,
198
- "--message",
199
- releaseTagAnnotation(tag, selection),
200
- ]);
201
304
  try {
202
- runTaskCommand(root, "git", ["push", remote, `refs/tags/${tag}`]);
305
+ pushAnnotatedReleaseTag({
306
+ annotation: releaseTagAnnotation(tag, selection),
307
+ branch,
308
+ head,
309
+ remote,
310
+ root,
311
+ tag,
312
+ });
203
313
  } catch (error) {
204
- runTaskCommand(root, "git", ["tag", "--delete", tag]);
314
+ if (taskCommandSucceeds(root, "git", ["rev-parse", "--verify", `refs/tags/${tag}`])) {
315
+ runTaskCommand(root, "git", ["tag", "--delete", tag]);
316
+ }
205
317
  throw error;
206
318
  }
207
319
  logger.success(`released ${tag}`, { sha: head });