Add release asset validation to Releaser workflow#544
Conversation
|
@BigLep 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: BigLep <85411+BigLep@users.noreply.github.com>
Co-authored-by: BigLep <85411+BigLep@users.noreply.github.com>
|
@galargh : is this what you had in mind? |
There was a problem hiding this comment.
Pull Request Overview
This PR adds automatic validation and building of missing release assets to the Releaser workflow. The workflow now ensures that all expected platform-specific assets are present in published releases and builds any missing ones to prevent downstream build failures.
- Adds a new
validate-and-build-missing-assetsjob that checks for required release assets - Implements platform-specific build logic for Linux x64, Linux ARM64, and macOS universal binaries
- Updates documentation to reflect the new automated asset validation capability
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| RELEASE.md | Updates documentation to reflect new asset validation feature and marks the improvement as implemented |
| .github/workflows/releaser.yml | Adds new job to validate release assets and build missing ones using platform-specific runners |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| RELEASE_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | ||
| "$RELEASE_URL/$RELEASE_ID") | ||
|
|
||
| if [ "$(echo $RELEASE_INFO | jq '.id')" = "null" ]; then |
There was a problem hiding this comment.
The condition checks for the string 'null' but jq returns the literal null value. This should be if [ "$(echo $RELEASE_INFO | jq '.id')" = "null" ]; then or better yet, use if [ "$(echo $RELEASE_INFO | jq -r '.id')" = "null" ]; then to get the raw output.
| if [ "$(echo $RELEASE_INFO | jq '.id')" = "null" ]; then | |
| if [ "$(echo $RELEASE_INFO | jq -r '.id')" = "null" ]; then |
| ".assets[] | select(.name == \"$EXPECTED_ASSET\") | .name") | ||
|
|
||
| if [ -n "$asset_exists" ]; then |
There was a problem hiding this comment.
[nitpick] The asset existence check could be simplified and made more robust by using jq's any() function: asset_exists=$(echo $RELEASE_INFO | jq -r '.assets | any(.name == \"'$EXPECTED_ASSET'\")') and then check for 'true'/'false' instead of checking if the variable is non-empty.
| ".assets[] | select(.name == \"$EXPECTED_ASSET\") | .name") | |
| if [ -n "$asset_exists" ]; then | |
| ".assets | any(.name == \"$EXPECTED_ASSET\")") | |
| if [ "$asset_exists" = "true" ]; then |
| if [ "$RUNNER_OS" = "Linux" ]; then | ||
| TARBALL_PATH="/tmp/$EXPECTED_ASSET" | ||
|
|
||
| $BUILD_CMD | ||
| ./scripts/package-release.sh $TARBALL_PATH | ||
|
|
||
| # Upload using the publish-release script | ||
| API_URL="https://api.github.com/repos" | ||
| RELEASE_URL="$API_URL/${{ github.repository }}/releases/$RELEASE_ID" | ||
| export GITHUB_RELEASE_URL="$RELEASE_URL" | ||
| ./scripts/publish-release.sh $TARBALL_PATH $EXPECTED_ASSET | ||
|
|
||
| elif [ "$RUNNER_OS" = "macOS" ]; then | ||
| TARBALL_PATH="/tmp/$EXPECTED_ASSET" | ||
|
|
||
| $BUILD_CMD | ||
| ./scripts/package-release.sh $TARBALL_PATH | ||
|
|
||
| # Upload using the publish-release script | ||
| API_URL="https://api.github.com/repos" | ||
| RELEASE_URL="$API_URL/${{ github.repository }}/releases/$RELEASE_ID" | ||
| export GITHUB_RELEASE_URL="$RELEASE_URL" | ||
| ./scripts/publish-release.sh $TARBALL_PATH $EXPECTED_ASSET | ||
| fi |
There was a problem hiding this comment.
[nitpick] The Linux and macOS build/upload logic is identical and duplicated. This should be extracted to eliminate code duplication - the conditional logic could be moved after the platform-specific asset name and build command determination.
|
Not quite, we have an action that already knows how to build and upload assets so I wouldn't replicate that logic here. |
|
Converting to draft until this is ready to get engaged on by a human. |
|
@galargh : I know we didn't have this on the December list, but if it's quick, please finish/improve just so we don't get bit by this again. |
|
Closing in favor of #560 |
The Releaser workflow now automatically validates that published releases contain all expected assets and builds/uploads any missing ones. This prevents downstream build failures in projects like Lotus when release assets are incomplete.
What this PR does
Adds a new
validate-and-build-missing-assetsjob to the Releaser workflow that:publish-release.shscript to upload any missing assetsExpected assets
The workflow validates and ensures these assets are present:
filecoin-ffi-Linux-x86_64-standard.tar.gz(Linux x64)filecoin-ffi-Linux-aarch64-standard.tar.gz(Linux ARM64)filecoin-ffi-Darwin-standard.tar.gz(macOS universal)Implementation details
Testing
Created comprehensive integration tests that validate:
Also updated
RELEASE.mdto document the new functionality and mark this improvement as implemented.Fixes #543.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.