Skip to content

Ensure script/release.sh is idempotent#1235

Merged
joshmgross merged 3 commits intomainfrom
idempotent-release
Mar 30, 2026
Merged

Ensure script/release.sh is idempotent#1235
joshmgross merged 3 commits intomainfrom
idempotent-release

Conversation

@joshmgross
Copy link
Copy Markdown
Contributor

@joshmgross joshmgross commented Mar 30, 2026

The assumption in #1234 that GoReleaser was idempotent was not correct, the workflow failed when attempting to republish existing assets to the GitHub Release -

  ⨯ release failed after 6m53s                       error=scm releases: failed to publish artifacts: failed to upload pscale_0.278.0_macOS_amd64.tar.gz: POST https://uploads.github.com/repos/planetscale/cli/releases/303388482/assets?name=pscale_0.278.0_macOS_amd64.tar.gz: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}]

https://github.com/planetscale/cli/actions/runs/23766950223/job/69248755043

GoReleaser does have a replace_existing_artifacts option, but I do not want to replace existing published releases. We can't avoid replace_existing_artifacts as far as I can tell - 844cf16

This adds some level of idempotency to script/release.sh by checking if a version already exists for each publish target.

@joshmgross joshmgross requested a review from a team as a code owner March 30, 2026 21:25
GoReleaser doesn't allow skipping just the GitHub publish step,
so this allows the rest of the release to be idempotent.
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@joshmgross joshmgross merged commit 51a487e into main Mar 30, 2026
4 checks passed
@joshmgross joshmgross deleted the idempotent-release branch March 30, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants