Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 18, 2025

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:

  1. Validates release assets - Checks if all expected assets are present in the published release
  2. Builds missing assets - If any assets are missing, builds them on the appropriate platform using the same scripts as the release-check workflow
  3. Uploads missing assets - Uses the existing publish-release.sh script to upload any missing assets

Expected 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

  • Safety first: Only runs after the main releaser job completes successfully
  • No duplication: Skips building if assets already exist to avoid unnecessary work
  • Platform-specific: Each runner (ubuntu-latest, self-hosted ARM64, macos-latest) only handles its own platform's asset
  • Reuses existing logic: Uses the same build/package/publish scripts as the release-check workflow for consistency
  • Proper error handling: Handles unknown runner configurations gracefully

Testing

Created comprehensive integration tests that validate:

  • Asset detection logic for all platform combinations
  • Correct behavior when all assets are present (skip building)
  • Correct behavior when specific assets are missing (build only missing ones)
  • JSON parsing logic and bash script validation

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.

Copy link
Author

Copilot AI commented Sep 18, 2025

@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.

@Copilot Copilot AI changed the title [WIP] Releaser workflow ensures the created/published release contains the expected assets Add release asset validation to Releaser workflow Sep 18, 2025
@Copilot Copilot AI requested a review from BigLep September 18, 2025 20:05
Copilot finished work on behalf of BigLep September 18, 2025 20:05
@BigLep BigLep requested a review from galargh September 23, 2025 14:59
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Sep 23, 2025
@BigLep
Copy link
Member

BigLep commented Sep 23, 2025

@galargh : is this what you had in mind?

@BigLep BigLep marked this pull request as ready for review September 23, 2025 15:00
@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 15:00
Copy link

@Copilot Copilot AI left a 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
Copy link
Preview

Copilot AI Sep 23, 2025

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.

Suggested change
if [ "$(echo $RELEASE_INFO | jq '.id')" = "null" ]; then
if [ "$(echo $RELEASE_INFO | jq -r '.id')" = "null" ]; then

Copilot uses AI. Check for mistakes.

Comment on lines +92 to +94
".assets[] | select(.name == \"$EXPECTED_ASSET\") | .name")
if [ -n "$asset_exists" ]; then
Copy link
Preview

Copilot AI Sep 23, 2025

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.

Suggested change
".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.

Comment on lines +104 to +127
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
Copy link
Preview

Copilot AI Sep 23, 2025

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.

@galargh
Copy link
Contributor

galargh commented Sep 27, 2025

Not quite, we have an action that already knows how to build and upload assets so I wouldn't replicate that logic here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 Awaiting Review
Development

Successfully merging this pull request may close these issues.

Releaser workflow ensures the created/published release contains the expected assets
3 participants