-
Notifications
You must be signed in to change notification settings - Fork 136
Add release asset validation to Releaser workflow #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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 <[email protected]>
Co-authored-by: BigLep <[email protected]>
@galargh : is this what you had in mind? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-assets
job 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot uses AI. Check for mistakes.
".assets[] | select(.name == \"$EXPECTED_ASSET\") | .name") | ||
if [ -n "$asset_exists" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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 |
Copilot uses AI. Check for mistakes.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Copilot uses AI. Check for mistakes.
Not quite, we have an action that already knows how to build and upload assets so I wouldn't replicate that logic here. |
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-assets
job to the Releaser workflow that:publish-release.sh
script 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.md
to 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.