From 19e37af09eff0a0ed4e100bf6d2bd920b0ba4d58 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Tue, 31 May 2022 12:02:02 -0700 Subject: [PATCH] Publish workflow: Add git tags during publish (#6312) --- scripts/release/release.ts | 5 ++--- scripts/release/utils/publish.ts | 13 +++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/release/release.ts b/scripts/release/release.ts index 08d776fee3b..40495826515 100644 --- a/scripts/release/release.ts +++ b/scripts/release/release.ts @@ -180,12 +180,11 @@ export async function runRelease({ } /** - * Changeset creates tags for staging releases as well, - * but we should only push tags to Github for prod releases + * Push tags to Github for prod releases only. */ if (releaseType === ReleaseType.Production && !dryRun) { /** - * Push release tags created by changeset in publish() to Github + * Push release tags created by changeset or publishInCI() to Github */ await pushReleaseTagsToGithub(); } diff --git a/scripts/release/utils/publish.ts b/scripts/release/utils/publish.ts index 26b649eddc0..2ff00b2a104 100644 --- a/scripts/release/utils/publish.ts +++ b/scripts/release/utils/publish.ts @@ -43,6 +43,7 @@ export async function publishInCI( dryRun: boolean ) { const taskArray = []; + const tags = []; for (const pkg of updatedPkgs) { const path = await mapPkgNameToPkgPath(pkg); @@ -79,8 +80,10 @@ export async function publishInCI( continue; } + const tag = `${pkg}@${version}`; + tags.push(tag); taskArray.push({ - title: `📦 ${pkg}@${version}`, + title: `📦 ${tag}`, task: () => publishPackageInCI(pkg, npmTag, dryRun) }); } @@ -91,7 +94,13 @@ export async function publishInCI( }); console.log('\r\nPublishing Packages to NPM:'); - return tasks.run(); + await tasks.run(); + + // Create git tags. + for (const tag of tags) { + await exec(`git tag ${tag}`); + console.log(`Added git tag ${tag}.`); + } } async function publishPackageInCI(