@@ -280,6 +280,43 @@ function applyDevVersions(packageNames, shortSha) {
280280 } ) ;
281281}
282282
283+ // Reports what a dev publish produced. A consumer must install the whole closure,
284+ // because each package's peer dependency range is pinned to the exact dev version of
285+ // the package below it. Written to the workflow run summary when running in Actions.
286+ function reportDevPublish ( publishedPackages , shortSha ) {
287+ const installCommand = `npm install ${ publishedPackages
288+ . map ( ( { name, version } ) => `${ name } @${ version } ` )
289+ . join ( ' ' ) } `;
290+
291+ console . log ( `--- Dev publish of ${ shortSha } complete ---` ) ;
292+ console . log ( installCommand ) ;
293+
294+ const summaryPath = process . env . GITHUB_STEP_SUMMARY ;
295+ if ( ! summaryPath ) {
296+ return ;
297+ }
298+
299+ const summary = [
300+ `## Dev publish of \`${ shortSha } \`` ,
301+ '' ,
302+ '| Package | Version |' ,
303+ '| --- | --- |' ,
304+ ...publishedPackages . map ( ( { name, version } ) => `| \`${ name } \` | \`${ version } \` |` ) ,
305+ '' ,
306+ 'Install the whole set — the peer dependency ranges are pinned to these exact versions:' ,
307+ '' ,
308+ '```sh' ,
309+ installCommand ,
310+ '```' ,
311+ '' ,
312+ 'Dev versions are permanent, unsupported and never removed. Do not reference one from' ,
313+ 'a production dependency.' ,
314+ '' ,
315+ ] . join ( '\n' ) ;
316+
317+ fs . appendFileSync ( summaryPath , summary ) ;
318+ }
319+
283320// Resolves as true only when the registry positively reports the version. A network
284321// failure resolves as false, so we attempt the publish and let it fail loudly rather
285322// than silently skipping a package that was never published.
@@ -422,15 +459,22 @@ async function main() {
422459
423460 const packagesToPublish = resolvePackagesToPublish ( ) ;
424461
425- if ( isDevPublish ) {
426- const shortSha = shortCommitSha ( ) ;
427- console . log ( `--- Dev publish of [${ packagesToPublish . join ( ', ' ) } ] at ${ shortSha } ---` ) ;
428- applyDevVersions ( packagesToPublish , shortSha ) ;
462+ if ( ! isDevPublish ) {
463+ for ( const packageName of packagesToPublish ) {
464+ await publishPipelines [ packageName ] ( ) ;
465+ }
466+ return ;
429467 }
430468
469+ const shortSha = shortCommitSha ( ) ;
470+ console . log ( `--- Dev publish of [${ packagesToPublish . join ( ', ' ) } ] at ${ shortSha } ---` ) ;
471+ const publishedPackages = applyDevVersions ( packagesToPublish , shortSha ) ;
472+
431473 for ( const packageName of packagesToPublish ) {
432474 await publishPipelines [ packageName ] ( ) ;
433475 }
476+
477+ reportDevPublish ( publishedPackages , shortSha ) ;
434478}
435479
436480main ( ) . catch ( ( error ) => {
0 commit comments