Skip to content

Commit eb90764

Browse files
committed
Merge remote-tracking branch 'origin/main' into 1.29-releases
2 parents 33a612a + fa3e64e commit eb90764

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/hadron-build/commands/upload.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)