Skip to content

Commit 5d2a79f

Browse files
jakex7Eric-Tyrrell22
authored andcommitted
[tools][pp] Assign sdk-x tag when publishing (expo#38988)
# Why Assigning sdk-x tag when publishing the templates are more convenient as next version should also have sdk tag # How Assign `sdk-x` tag on `et pp` # Test Plan Publish template with `et pp expo-template-default --dry` and check console for the `Assigning sdk-54 tag to expo-template-default`
1 parent 1c54504 commit 5d2a79f

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

tools/src/promote-packages/tasks/promotePackages.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import chalk from 'chalk';
2-
import * as semver from 'semver';
32

43
import { findPackagesToPromote } from './findPackagesToPromote';
54
import { prepareParcels } from './prepareParcels';
@@ -48,20 +47,6 @@ export const promotePackages = new Task<TaskArgs>(
4847
stdio: requiresOTP ? 'inherit' : undefined,
4948
});
5049
}
51-
if (pkg.isTemplate()) {
52-
const sdkTag = `sdk-${semver.major(pkg.packageVersion)}`;
53-
batch.log(
54-
' ',
55-
action,
56-
yellow(sdkTag),
57-
formatVersionChange(versionToReplace, currentVersion)
58-
);
59-
if (!options.dry) {
60-
await Npm.addTagAsync(pkg.packageName, pkg.packageVersion, sdkTag, {
61-
stdio: requiresOTP ? 'inherit' : undefined,
62-
});
63-
}
64-
}
6550

6651
// If the local version had any tags assigned, we can drop the old ones.
6752
if (options.drop && state.distTags && !state.distTags.includes(options.tag)) {

tools/src/publish-packages/tasks/publishPackages.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from 'chalk';
33
import fs from 'fs-extra';
44
import inquirer from 'inquirer';
55
import path from 'path';
6+
import semver from 'semver';
67

78
import { checkPackageAccess } from './checkPackageAccess';
89
import { selectPackagesToPublish } from './selectPackagesToPublish';
@@ -64,6 +65,16 @@ export const publishPackages = new Task<TaskArgs>(
6465
stdio: requiresOTP ? 'inherit' : undefined,
6566
},
6667
});
68+
// Assign SDK tag when package is a template
69+
if (pkg.isTemplate()) {
70+
const sdkTag = `sdk-${semver.major(pkg.packageVersion)}`;
71+
logger.log(' ', `Assigning ${yellow(sdkTag)} tag to ${green(pkg.packageName)}`);
72+
if (!options.dry) {
73+
await Npm.addTagAsync(pkg.packageName, pkg.packageVersion, sdkTag, {
74+
stdio: requiresOTP ? 'inherit' : undefined,
75+
});
76+
}
77+
}
6778
} catch (error) {
6879
if (error.stderr.includes('You cannot publish over the previously published versions:')) {
6980
const { confirmed } = await inquirer.prompt<{ confirmed: boolean }>([

0 commit comments

Comments
 (0)