Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Dec 21, 2024
1 parent 734433a commit 8b630c2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/publish-step-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,35 @@ jobs:
let release = releases.find(release => release.tag_name === tag_name);
if (release) {
console.log(`Existing release found: ${JSON.stringify(release, null, 2)}`);
if (!release.draft) {
console.log(`Release for tag ${tag_name} is already published. Exiting with error.`);
core.setFailed(`Release for tag ${tag_name} is already published.`);
return;
}
console.log(`Draft release for tag ${tag_name} already exists.`);
// console.log(`Draft release for tag ${tag_name} already exists.`);
// Update the release to point to potentially new commit (noop when no change)
const release_id = release.id;
release = await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
release_id: release_id,
tag_name: tag_name,
target_commitish: context.sha,
});
console.log(`updateRelease result: ${JSON.stringify(release, null, 2)}`);
// Retrieve the latest draft release object to get the upload_url
const { data: updatedRelease } = await github.rest.repos.getRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
release_id: release_id,
});
console.log(`getRelease result: ${JSON.stringify(updatedRelease, null, 2)}`);
upload_url = updatedRelease.upload_url;
} else {
// Release does not exists, so create it.
Expand Down

0 comments on commit 8b630c2

Please sign in to comment.