1111 *
1212 * Re-runs are idempotent via `gh release upload --clobber` (see gh-release.mjs).
1313 * After the GitHub upload the same assets are pushed straight to OSS from the
14- * runner, HEAD-reconciled, and (stable only) release/manifest.json is updated —
14+ * runner, HEAD-reconciled, and (stable only) release/manifest.json + latest.json
15+ * are rewritten with the SAME rolling-manifest body as channel `<channel>.json` —
1516 * all in-process, no external FC (see oss-direct-upload.mjs).
1617 *
1718 * Called by publish-stable.mjs / publish-channel.mjs.
2021 * node tools/release/lib/binary-release.mjs --mode channel --channel beta --dry-run
2122 */
2223import { existsSync , readdirSync , readFileSync } from "node:fs" ;
23- import { basename , join , resolve } from "node:path" ;
24+ import { join , resolve } from "node:path" ;
2425import { fileURLToPath } from "node:url" ;
2526import { parseArgs as parseCliArgs } from "node:util" ;
2627import { ROOT , readPackageJson , PACKAGES } from "./packages.mjs" ;
2728import { buildBinaryArtifacts , matrixAssetNames } from "./binary-build.mjs" ;
2829import { channelManifestFileName , normalizeModeChannel } from "./binary-options.mjs" ;
2930import { ensureGh , GITHUB_REPOSITORY , upsertRelease } from "./gh-release.mjs" ;
30- import { maintainReleaseManifest , mirrorReleaseAssetsToOss } from "./oss-direct-upload.mjs" ;
31+ import {
32+ maintainReleaseManifest ,
33+ mirrorReleaseAssetsToOss ,
34+ syncStaticFilesToOss ,
35+ } from "./oss-direct-upload.mjs" ;
3136
3237const DEFAULT_DIR = join ( ROOT , "dist-bin" ) ;
3338
@@ -179,11 +184,14 @@ export async function releaseBinaryArtifacts(rawOptions = {}) {
179184 process . stdout . write ( `[dry-run] ${ dir } missing; planning expected assets\n` ) ;
180185 planDryRunWithoutArtifacts ( { version, mode, channel } ) ;
181186 const plans = ossMirrorPlans ( { dir, version, mode, channel, files : null } ) ;
187+ await syncStaticFilesToOss ( {
188+ filePaths : [ join ( ROOT , "CHANGELOG.md" ) , join ( ROOT , "CHANGELOG.zh.md" ) ] ,
189+ dryRun : true ,
190+ } ) ;
182191 await mirrorReleaseAssetsToOss ( { plans, dryRun : true } ) ;
183192 if ( mode === "stable" ) {
184193 await maintainReleaseManifest ( {
185194 tag : `v${ version } ` ,
186- assetNames : plans [ 0 ] . paths . map ( ( path ) => basename ( path ) ) ,
187195 channelJsonPath : null ,
188196 dryRun : true ,
189197 } ) ;
@@ -226,6 +234,11 @@ export async function releaseBinaryArtifacts(rawOptions = {}) {
226234 uploadChannel ( { dir, version, channel, files, dryRun } ) ;
227235 }
228236
237+ // Sync changelogs (and other static files) to OSS before the binary mirror.
238+ await syncStaticFilesToOss ( {
239+ filePaths : [ join ( ROOT , "CHANGELOG.md" ) , join ( ROOT , "CHANGELOG.zh.md" ) ] ,
240+ dryRun,
241+ } ) ;
229242 // Push the exact Release assets straight to OSS from the runner, then
230243 // HEAD-reconcile. Stable releases additionally maintain release/manifest.json
231244 // (newer-version guard). Throws on failure — CI is the only OSS writer.
@@ -234,7 +247,6 @@ export async function releaseBinaryArtifacts(rawOptions = {}) {
234247 if ( mode === "stable" && ! mirror . skipped ) {
235248 await maintainReleaseManifest ( {
236249 tag : `v${ version } ` ,
237- assetNames : plans [ 0 ] . paths . map ( ( path ) => basename ( path ) ) ,
238250 channelJsonPath : join ( dir , rollingManifest ) ,
239251 dryRun,
240252 } ) ;
0 commit comments