ci: fix goreleaser v2 mainnet-beta build by removing CARGO_TARGET_DIR#3258
Merged
ci: fix goreleaser v2 mainnet-beta build by removing CARGO_TARGET_DIR#3258
Conversation
…-beta build GoReleaser v2 doesn't support the 'path' field in rust builds. Using CARGO_TARGET_DIR environment variable instead to specify the custom target directory for mainnet-beta builds.
After PR #3243 set CARGO_TARGET_DIR=target/mainnet-beta, the built binary is placed in target/mainnet-beta/x86_64-unknown-linux-gnu/release/ instead of the standard target/x86_64-unknown-linux-gnu/release/ location. GoReleaser v2 expects binaries at the standard location. This commit adds a post-build step to copy the binary from the custom target directory to where GoReleaser expects to find it.
8805552 to
0c000d3
Compare
snormore
approved these changes
Mar 13, 2026
GoReleaser v2 handles sequential Rust builds correctly by copying each binary to dist/ immediately after building, before the next build overwrites the target directory. The custom CARGO_TARGET_DIR was causing issues because GoReleaser couldn't find the binary in the expected location.
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
CARGO_TARGET_DIRenvironment variableContext
PR #3243 added
CARGO_TARGET_DIR=target/mainnet-betato prevent the mainnet-beta build from overwriting the testnet build. However, this causes failures with GoReleaser v2 because:target/x86_64-unknown-linux-gnu/release/CARGO_TARGET_DIR=target/mainnet-beta, the binary is built attarget/mainnet-beta/x86_64-unknown-linux-gnu/release/Solution
Remove
CARGO_TARGET_DIRentirely. GoReleaser v2 handles multiple Rust builds correctly by:Testing Verification
goreleaser release --snapshot- both binaries build successfully84b09ea4..., size: 15358696)8d9482de..., size: 15358472)