@@ -13,8 +13,7 @@ import {
1313/**
1414 * Decides what one `.github/workflows/release.yml` run does, from the event that started it:
1515 * pull_request dry-run: build and verify every package, publish nothing
16- * schedule / nightly nightly: publish main's HEAD under the `nightly` dist-tag
17- * dispatch stable on main promote: tag the latest nightly's commit and start its stable run
16+ * schedule / dispatch nightly: publish main's HEAD under the `nightly` dist-tag
1817 * vX.Y.Z tag stable: publish that commit under the `latest` dist-tag
1918 * `tags` maps remote tag names to commits; `ciConclusion` and `onMain` describe `sha`.
2019 */
@@ -26,7 +25,7 @@ export function planRelease(run) {
2625 if ( run . ref !== 'refs/heads/main' ) {
2726 throw new Error ( `Releases run from main or a vX.Y.Z tag, not ${ run . ref } .` ) ;
2827 }
29- return run . channel === 'stable' ? planPromotion ( run ) : planNightly ( run ) ;
28+ return planNightly ( run ) ;
3029}
3130
3231function planNightly ( run ) {
@@ -48,16 +47,6 @@ function planNightly(run) {
4847 return { mode : 'nightly' , version, distTag : 'nightly' , commit : run . sha } ;
4948}
5049
51- function planPromotion ( run ) {
52- const nightly = latestNightlyTag ( [ ...run . tags . keys ( ) ] ) ;
53- if ( ! nightly ) throw new Error ( 'No nightly has been published to promote.' ) ;
54- const version = run . requestedVersion || nightlyBase ( nightly . slice ( 1 ) ) ;
55- if ( ! isReleaseVersion ( version ) ) throw new Error ( `${ version } is not an X.Y.Z release version.` ) ;
56- if ( run . tags . has ( `v${ version } ` ) ) throw new Error ( `v${ version } is already tagged.` ) ;
57- assertAheadOfStable ( run , version ) ;
58- return { mode : 'promote' , version, commit : run . tags . get ( nightly ) , nightly } ;
59- }
60-
6150function planStable ( run , tag ) {
6251 const version = tag . slice ( 1 ) ;
6352 if ( ! tag . startsWith ( 'v' ) || ! isReleaseVersion ( version ) ) {
@@ -68,6 +57,11 @@ function planStable(run, tag) {
6857 throw new Error ( `${ version } is older than the published ${ run . latestStable } .` ) ;
6958 }
7059 if ( ! run . onMain ) throw new Error ( `${ tag } is not on main.` ) ;
60+ if ( run . ciConclusion !== 'success' ) {
61+ throw new Error (
62+ `CI on ${ run . sha } is ${ run . ciConclusion } . Once it passes, run Release on ${ tag } to publish it.` ,
63+ ) ;
64+ }
7165 const previousTag = previousReleaseTag ( [ ...run . tags . keys ( ) ] , version ) ?? '' ;
7266 return { mode : 'stable' , version, distTag : 'latest' , commit : run . sha , previousTag } ;
7367}
@@ -84,10 +78,12 @@ function assertAheadOfStable(run, version) {
8478 }
8579}
8680
87- /** Remote tags by name, resolved to the commit each one points at. */
81+ /** Remote release and nightly tags by name, resolved to the commit each one points at. */
8882function remoteTags ( ) {
8983 const tags = new Map ( ) ;
90- const output = execFileSync ( 'git' , [ 'ls-remote' , '--tags' , 'origin' , 'v*' ] , { encoding : 'utf8' } ) ;
84+ const output = execFileSync ( 'git' , [ 'ls-remote' , '--tags' , 'origin' , 'v*' , 'nightly/*' ] , {
85+ encoding : 'utf8' ,
86+ } ) ;
9187 for ( const line of output . split ( '\n' ) . filter ( Boolean ) ) {
9288 const [ commit , name ] = line . split ( '\t' ) ;
9389 const tag = name . replace ( / ^ r e f s \/ t a g s \/ / , '' ) ;
@@ -138,14 +134,12 @@ async function readRun(env) {
138134 event,
139135 ref,
140136 sha : env . GITHUB_SHA ,
141- channel : env . RELEASE_CHANNEL || 'nightly' ,
142- requestedVersion : env . RELEASE_VERSION ,
143137 rootVersion : JSON . parse ( fs . readFileSync ( 'package.json' , 'utf8' ) ) . version ,
144138 today : new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) . replaceAll ( '-' , '' ) ,
145139 runNumber : env . GITHUB_RUN_NUMBER ,
146140 tags : event === 'pull_request' ? new Map ( ) : remoteTags ( ) ,
147141 latestStable : onBranch || onTag ? await latestStable ( ) : null ,
148- ciConclusion : onBranch ? await ciConclusion ( env ) : undefined ,
142+ ciConclusion : onBranch || onTag ? await ciConclusion ( env ) : undefined ,
149143 onMain : onTag ? await isOnMain ( env ) : undefined ,
150144 } ;
151145}
0 commit comments