Skip to content

Commit

Permalink
Publish workflow: Add git tags during publish (#6312)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 authored May 31, 2022
1 parent db0dd9f commit 19e37af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 2 additions & 3 deletions scripts/release/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
13 changes: 11 additions & 2 deletions scripts/release/utils/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export async function publishInCI(
dryRun: boolean
) {
const taskArray = [];
const tags = [];
for (const pkg of updatedPkgs) {
const path = await mapPkgNameToPkgPath(pkg);

Expand Down Expand Up @@ -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)
});
}
Expand All @@ -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(
Expand Down

0 comments on commit 19e37af

Please sign in to comment.