Skip to content

Commit 19e37af

Browse files
authored
Publish workflow: Add git tags during publish (#6312)
1 parent db0dd9f commit 19e37af

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

scripts/release/release.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,11 @@ export async function runRelease({
180180
}
181181

182182
/**
183-
* Changeset creates tags for staging releases as well,
184-
* but we should only push tags to Github for prod releases
183+
* Push tags to Github for prod releases only.
185184
*/
186185
if (releaseType === ReleaseType.Production && !dryRun) {
187186
/**
188-
* Push release tags created by changeset in publish() to Github
187+
* Push release tags created by changeset or publishInCI() to Github
189188
*/
190189
await pushReleaseTagsToGithub();
191190
}

scripts/release/utils/publish.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export async function publishInCI(
4343
dryRun: boolean
4444
) {
4545
const taskArray = [];
46+
const tags = [];
4647
for (const pkg of updatedPkgs) {
4748
const path = await mapPkgNameToPkgPath(pkg);
4849

@@ -79,8 +80,10 @@ export async function publishInCI(
7980
continue;
8081
}
8182

83+
const tag = `${pkg}@${version}`;
84+
tags.push(tag);
8285
taskArray.push({
83-
title: `📦 ${pkg}@${version}`,
86+
title: `📦 ${tag}`,
8487
task: () => publishPackageInCI(pkg, npmTag, dryRun)
8588
});
8689
}
@@ -91,7 +94,13 @@ export async function publishInCI(
9194
});
9295

9396
console.log('\r\nPublishing Packages to NPM:');
94-
return tasks.run();
97+
await tasks.run();
98+
99+
// Create git tags.
100+
for (const tag of tags) {
101+
await exec(`git tag ${tag}`);
102+
console.log(`Added git tag ${tag}.`);
103+
}
95104
}
96105

97106
async function publishPackageInCI(

0 commit comments

Comments
 (0)