fix(ci): Prevent immutable release failures with defensive checks#17
Merged
fix(ci): Prevent immutable release failures with defensive checks#17
Conversation
Root cause: The release workflow created published releases before verifying artifacts were downloaded, resulting in immutable releases with 0 assets that could not be modified. This caused the error: "Cannot upload assets to an immutable release." This commit adds two critical defensive checks: 1. Verify downloaded artifacts (.github/workflows/release.yml:540-574) - Ensures release-artifacts directory exists and contains files - Counts and validates archive files (.tar.gz, .zip) - Lists all artifacts for debugging - Fails fast if no artifacts found 2. Check for existing release (.github/workflows/release.yml:576-609) - Detects if release already exists before creation - Identifies broken releases (published with 0 assets) - Automatically deletes broken releases to allow recreation - Prevents overwriting valid published releases with assets These checks ensure all artifacts are present and verified before creating the GitHub release, preventing immutable release errors. $fix
📊 Coverage Report
View detailed reportGenerated by cargo-tarpaulin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the "Cannot upload assets to an immutable release" error that caused the release workflow to fail after creating a release with 0 assets.
Key Changes
🛡️ Defensive Checks Added
1. Verify downloaded artifacts (.github/workflows/release.yml:540-574)
2. Check for existing release (.github/workflows/release.yml:576-609)
🐛 Bug Fixed
The workflow was failing with this error:
Sequence of events:
softprops/action-gh-releasecreates release withdraft: falseWhy this happened:
The
download-artifactstep wasn't being verified before release creation. If artifacts were missing or incomplete, the release would still be created as published, then fail when trying to add assets.Testing
Manual verification:
gh release delete v0.1.2Workflow validation:
CI/CD Status
This PR will trigger the following CI checks:
Note: This PR only modifies workflow files, not Rust source code.
Type of Change
Related Issues
Fixes: https://github.com/nutthead/ruloc/actions/runs/18313096691/job/52146493329
This workflow run created release v0.1.2 with 0 assets, then failed when trying to upload files to the immutable release.
Breaking Changes
None - this PR only fixes CI/CD workflows and does not change any user-facing functionality or API.
Release Impact
Version bump: patch
Changelog category: CI/CD improvements
Footer tags used:
$fixThis PR will be included in the next release created by release-plz.
Pre-merge Checklist
/ccommand)cargo fmt --all(N/A - no Rust code changes)cargo clippy --all-targets --all-features -- -D warningscargo testcargo tarpaulinAdditional Context
Implementation Details
Artifact verification ensures the workflow fails fast if:
release-artifacts/directory doesn't exist.tar.gzor.ziparchives foundRelease existence check handles three scenarios:
Why This Matters
Without these checks:
With these checks:
Testing Strategy
Defensive checks follow the pattern from Hard Rule 10:
This ensures: