Skip to content

Commit 72e31f0

Browse files
committed
Allow tag publish to fail, assume it was manually published
1 parent 35f08a8 commit 72e31f0

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

src/run.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,16 @@ export async function runPublish({
160160
const tagName = `${pkg.packageJson.name}@${pkg.packageJson.version}`;
161161
// Tag will only be created locally,
162162
// Create it using the GitHub API so it's signed.
163-
await octokit.rest.git.createRef({
164-
...github.context.repo,
165-
ref: `refs/tags/${tagName}`,
166-
sha: github.context.sha,
167-
});
163+
await octokit.rest.git
164+
.createRef({
165+
...github.context.repo,
166+
ref: `refs/tags/${tagName}`,
167+
sha: github.context.sha,
168+
})
169+
.catch((err) => {
170+
// Assuming tag was manually pushed in custom publish script
171+
core.warning(`Failed to create tag ${tagName}: ${err.message}`);
172+
});
168173
if (createGithubReleases) {
169174
await createRelease(octokit, { pkg, tagName });
170175
}
@@ -189,11 +194,16 @@ export async function runPublish({
189194
const tagName = `v${pkg.packageJson.version}`;
190195
// Tag will only be created locally,
191196
// Create it using the GitHub API so it's signed.
192-
await octokit.rest.git.createRef({
193-
...github.context.repo,
194-
ref: `refs/tags/${tagName}`,
195-
sha: github.context.sha,
196-
});
197+
await octokit.rest.git
198+
.createRef({
199+
...github.context.repo,
200+
ref: `refs/tags/${tagName}`,
201+
sha: github.context.sha,
202+
})
203+
.catch((err) => {
204+
// Assuming tag was manually pushed in custom publish script
205+
core.warning(`Failed to create tag ${tagName}: ${err.message}`);
206+
});
197207
if (createGithubReleases) {
198208
await createRelease(octokit, { pkg, tagName });
199209
}

0 commit comments

Comments
 (0)