File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/hadron-build/commands Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,31 @@ exports.handler = function(argv) {
8383 return ;
8484 }
8585
86+ if ( process . env . CI && ! process . env . EVERGREEN_PROJECT ) {
87+ cli . warn ( 'Trying to publish a release from non-Evergreen CI environment' ) ;
88+ return ;
89+ }
90+
91+ if ( process . env . EVERGREEN_PROJECT ) {
92+ const projectChannel = process . env . EVERGREEN_PROJECT . split ( '-' ) . pop ( ) ;
93+ if ( ! [ 'stable' , 'testing' ] . includes ( projectChannel ) ) {
94+ cli . warn (
95+ `Trying to publish a release from unsupported Evergreen project. Expected stable or testing, got ${ projectChannel } `
96+ ) ;
97+ return ;
98+ }
99+ const channelToProjectMap = {
100+ testing : 'beta'
101+ } ;
102+ const mappedChannel = channelToProjectMap [ projectChannel ] || projectChannel ;
103+ if ( target . channel !== mappedChannel ) {
104+ cli . warn (
105+ `Trying to publish a release from mismatched channel. Expected ${ target . channel } , got ${ mappedChannel } `
106+ ) ;
107+ return ;
108+ }
109+ }
110+
86111 target . assets = target . assets . filter ( function ( asset ) {
87112 // eslint-disable-next-line no-sync
88113 var exists = fs . existsSync ( asset . path ) ;
You can’t perform that action at this time.
0 commit comments