Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tools] Add SDK tag to canary templates #27711

Merged
merged 1 commit into from Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}`;
}