Skip to content

Commit 848995a

Browse files
committed
feat(pdk): adjust the order of packaging workflow
1 parent c6278d6 commit 848995a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

infra/pdk/src/commands/release.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
106106
// Set environment variable for build scripts
107107
process.env.RELEASE_VERSION = version;
108108

109-
// Run build script if specified
110-
if (build) {
111-
await runBuildScript(build, cwd, dryRun);
112-
}
113-
114109
// Load workspace packages
115110
const packages = await loadWorkspacePackages(cwd);
116111

@@ -133,7 +128,8 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
133128
return;
134129
}
135130

136-
// Update all package versions (without committing)
131+
// Update all package versions FIRST (before build)
132+
// This ensures build scripts can read the correct version from package.json
137133
packages.forEach((pkg) => {
138134
const packageJsonPath = join(pkg.dir, 'package.json');
139135
if (dryRun) {
@@ -161,6 +157,11 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
161157
}
162158
}
163159

160+
// Run build script if specified (now with updated version)
161+
if (build) {
162+
await runBuildScript(build, cwd, dryRun);
163+
}
164+
164165
// Publish packages with workspace dependency management
165166
// Dependency replacement is handled within publishPackages to avoid duplication
166167
await publishPackages(

infra/pdk/src/utils/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ export async function runBuildScript(
3434
stdio: 'inherit',
3535
env: process.env,
3636
});
37-
}
37+
}

0 commit comments

Comments
 (0)