@@ -76,11 +76,23 @@ async function releaseMonorepoRcs (commit, ctx) {
76
76
77
77
await retry ( async ( ) => {
78
78
console . info ( `npm publish --tag ${ ctx . tag } --dry-run ${ ! process . env . CI } ` )
79
- await execa ( 'npm' , [ 'publish' , '--tag' , ctx . tag , '--dry-run' , `${ ! process . env . CI } ` ] , {
80
- stdout : 'inherit' ,
81
- stderr : 'inherit' ,
82
- cwd : project . dir
83
- } )
79
+
80
+ try {
81
+ await execa ( 'npm' , [ 'publish' , '--tag' , ctx . tag , '--dry-run' , `${ ! process . env . CI } ` ] , {
82
+ stdout : 'inherit' ,
83
+ stderr : 'inherit' ,
84
+ cwd : project . dir ,
85
+ all : true
86
+ } )
87
+ } catch ( /** @type {any } */ err ) {
88
+ if ( err . all ?. includes ( 'You cannot publish over the previously published versions' ) ) {
89
+ // this appears to be a bug in npm, sometimes you publish successfully but it also
90
+ // returns an error
91
+ return
92
+ }
93
+
94
+ throw err
95
+ }
84
96
} , {
85
97
retries : ctx . retries
86
98
} )
@@ -107,10 +119,22 @@ async function releaseRc (commit, ctx) {
107
119
108
120
await retry ( async ( ) => {
109
121
console . info ( `npm publish --tag ${ ctx . tag } --dry-run ${ ! process . env . CI } ` )
110
- await execa ( 'npm' , [ 'publish' , '--tag' , ctx . tag , '--dry-run' , `${ ! process . env . CI } ` ] , {
111
- stdout : 'inherit' ,
112
- stderr : 'inherit'
113
- } )
122
+
123
+ try {
124
+ await execa ( 'npm' , [ 'publish' , '--tag' , ctx . tag , '--dry-run' , `${ ! process . env . CI } ` ] , {
125
+ stdout : 'inherit' ,
126
+ stderr : 'inherit' ,
127
+ all : true
128
+ } )
129
+ } catch ( /** @type {any } */ err ) {
130
+ if ( err . all ?. includes ( 'You cannot publish over the previously published versions' ) ) {
131
+ // this appears to be a bug in npm, sometimes you publish successfully but it also
132
+ // returns an error
133
+ return
134
+ }
135
+
136
+ throw err
137
+ }
114
138
} , {
115
139
retries : ctx . retries
116
140
} )
0 commit comments