Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-dryers-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Fix custom publish scripts that don't create tags locally
5 changes: 5 additions & 0 deletions .changeset/three-women-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Fix tags not pushing when `createGithubReleases` is false
5 changes: 4 additions & 1 deletion src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export class Git {
core.warning(`Failed to create tag ${tag}: ${err.message}`);
});
}
await exec("git", ["push", "origin", tag], { cwd: this.cwd });
await exec("git", ["push", "origin", tag], {
cwd: this.cwd,
ignoreReturnCode: true,
});
}

async prepareBranch(branch: string) {
Expand Down
30 changes: 18 additions & 12 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ export async function runPublish({
releasedPackages.push(pkg);
}

if (createGithubReleases) {
await Promise.all(
releasedPackages.map(async (pkg) => {
const tagName = `${pkg.packageJson.name}@${pkg.packageJson.version}`;
await git.pushTag(tagName);
await Promise.all(
releasedPackages.map(async (pkg) => {
const tagName = `${pkg.packageJson.name}@${pkg.packageJson.version}`;
await git.pushTag(tagName);
if (createGithubReleases) {
await createRelease(octokit, { pkg, tagName });
})
);
}
}
})
);
} else {
if (packages.length === 0) {
throw new Error(
Expand All @@ -139,9 +139,9 @@ export async function runPublish({

if (match) {
releasedPackages.push(pkg);
const tagName = `v${pkg.packageJson.version}`;
await git.pushTag(tagName);
if (createGithubReleases) {
const tagName = `v${pkg.packageJson.version}`;
await git.pushTag(tagName);
await createRelease(octokit, { pkg, tagName });
}
break;
Expand Down Expand Up @@ -330,7 +330,7 @@ export async function runVersion({
/**
* Fetch any existing pull requests that are open against the branch,
* before we push any changes that may inadvertently close the existing PRs.
*
*
* (`@changesets/ghcommit` has to reset the branch to the same commit as the base,
* which GitHub will then react to by closing the PRs)
*/
Expand All @@ -340,7 +340,13 @@ export async function runVersion({
head: `${github.context.repo.owner}:${versionBranch}`,
base: branch,
});
core.info(`Existing pull requests: ${JSON.stringify(existingPullRequests.data, null, 2)}`);
core.info(
`Existing pull requests: ${JSON.stringify(
existingPullRequests.data,
null,
2
)}`
);

await git.pushChanges({ branch: versionBranch, message: finalCommitMessage });

Expand Down