Skip to content

Commit

Permalink
[tools] Add SDK tag to canary templates (#27711)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsapeta committed Mar 16, 2024
1 parent 8523cbe commit d697b27
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tools/src/publish-packages/tasks/publishCanary.ts
Expand Up @@ -14,7 +14,7 @@ import { updateWorkspaceProjects } from './updateWorkspaceProjects';
import { PACKAGES_DIR } from '../../Constants';
import Git from '../../Git';
import logger from '../../Logger';
import { getPackageViewAsync, publishPackageAsync } from '../../Npm';
import { addTagAsync, getPackageViewAsync, publishPackageAsync } from '../../Npm';
import {
getAvailableProjectTemplatesAsync,
updateTemplateVersionsAsync,
Expand Down Expand Up @@ -100,6 +100,13 @@ const publishCanaryProjectTemplates = new Task<TaskArgs>(
tagName: 'canary',
dryRun: options.dry,
});

if (!options.dry) {
// Add additional `sdk-X` tag for canary templates.
// Prebuild command uses this tag to download the proper version of bare-minimum template.
const sdkTag = getSdkTagForVersion(canaryVersion);
await addTagAsync(template.name, canaryVersion, sdkTag);
}
}
},
'Updated and published project templates'
Expand Down Expand Up @@ -233,3 +240,11 @@ async function getNextSdkVersion(): Promise<string> {
}
return nextMajorVersion;
}

/**
* Returns the SDK tag to use for the given package version.
*/
function getSdkTagForVersion(version: string): string {
const major = semver.major(version);
return `sdk-${major}`;
}

0 comments on commit d697b27

Please sign in to comment.