in scripts/validateRelease.ts [19:51]
function validateRelease(publishTag: string, dropPath: string): void {
const files = readdirSync(dropPath).filter((f) => f.endsWith('.tgz'));
if (files.length !== 1) {
throw new Error('Drop path should have one tgz file');
}
const match = files[0]?.match(/^azure-functions-(.*)\.tgz$/);
if (!match || !match[1]) {
throw new Error(`Unrecognized tgz file name "${files[0]}"`);
}
const versionNumber = match[1];
let regex: RegExp;
let expectedFormat: string;
switch (publishTag) {
case 'preview':
regex = /^[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$/;
expectedFormat = 'x.x.x-alpha.x';
break;
case 'latest':
case 'legacy':
regex = /^[0-9]+\.[0-9]+\.[0-9]+$/;
expectedFormat = 'x.x.x';
break;
default:
throw new Error(`Unrecognized publish tag "${publishTag}"`);
}
if (!regex.test(versionNumber)) {
throw new Error(
`Version number for tag "${publishTag}" should be in format "${expectedFormat}". Instead got "${versionNumber}"`
);
}
}