mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-18 16:45:11 +00:00
fix(release): include CLI in Linux artifacts (#7794)
This commit is contained in:
+51
-13
@@ -406,11 +406,16 @@ jobs:
|
||||
# Force rebuild by touching build.rs
|
||||
touch rustfs/build.rs
|
||||
|
||||
BINARY_ARGS=(--bin rustfs)
|
||||
if [[ "${{ matrix.platform }}" == "linux" ]]; then
|
||||
BINARY_ARGS+=(--bin rustfs-cli)
|
||||
fi
|
||||
|
||||
if [[ "${{ matrix.cross }}" == "true" ]]; then
|
||||
# All cross targets in the matrix are Linux; zigbuild handles them.
|
||||
cargo zigbuild --release --target ${{ matrix.target }} -p rustfs --bin rustfs
|
||||
cargo zigbuild --release --target ${{ matrix.target }} -p rustfs "${BINARY_ARGS[@]}"
|
||||
else
|
||||
cargo build --release --target ${{ matrix.target }} -p rustfs --bin rustfs
|
||||
cargo build --release --target ${{ matrix.target }} -p rustfs "${BINARY_ARGS[@]}"
|
||||
fi
|
||||
|
||||
- name: Create release package
|
||||
@@ -498,17 +503,24 @@ jobs:
|
||||
BINARY_NAME="rustfs"
|
||||
fi
|
||||
|
||||
# Verify the binary exists before packaging
|
||||
if [[ ! -f "$BINARY_NAME" ]]; then
|
||||
echo "❌ Binary $BINARY_NAME not found in $(pwd)"
|
||||
if [[ "${{ matrix.platform }}" == "windows" ]]; then
|
||||
dir
|
||||
else
|
||||
ls -la
|
||||
fi
|
||||
exit 1
|
||||
BINARY_FILES=("$BINARY_NAME")
|
||||
if [[ "${{ matrix.platform }}" == "linux" ]]; then
|
||||
BINARY_FILES+=("rustfs-cli")
|
||||
fi
|
||||
|
||||
# Verify the binaries exist before packaging
|
||||
for binary in "${BINARY_FILES[@]}"; do
|
||||
if [[ ! -f "$binary" ]]; then
|
||||
echo "❌ Binary $binary not found in $(pwd)"
|
||||
if [[ "${{ matrix.platform }}" == "windows" ]]; then
|
||||
dir
|
||||
else
|
||||
ls -la
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Universal packaging function
|
||||
package_zip() {
|
||||
local src=$1
|
||||
@@ -526,8 +538,12 @@ jobs:
|
||||
}
|
||||
|
||||
# Create the zip package
|
||||
echo "Start packaging: $BINARY_NAME -> ../../../${PACKAGE_NAME}.zip"
|
||||
package_zip "$BINARY_NAME" "../../../${PACKAGE_NAME}.zip"
|
||||
echo "Start packaging: ${BINARY_FILES[*]} -> ../../../${PACKAGE_NAME}.zip"
|
||||
if [[ "${{ matrix.platform }}" == "linux" ]]; then
|
||||
zip "../../../${PACKAGE_NAME}.zip" "${BINARY_FILES[@]}"
|
||||
else
|
||||
package_zip "$BINARY_NAME" "../../../${PACKAGE_NAME}.zip"
|
||||
fi
|
||||
|
||||
cd ../../..
|
||||
|
||||
@@ -601,6 +617,28 @@ jobs:
|
||||
echo "🔧 Build type: ${BUILD_TYPE}"
|
||||
echo "📊 Version: ${VERSION}"
|
||||
|
||||
- name: Verify packaged Linux CLI
|
||||
if: matrix.platform == 'linux'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
package_file="${{ steps.package.outputs.package_file }}"
|
||||
archive_members="$(unzip -Z1 "$package_file" | sort)"
|
||||
expected_members=$'rustfs\nrustfs-cli'
|
||||
if [[ "$archive_members" != "$expected_members" ]]; then
|
||||
echo "Linux package must contain exactly rustfs and rustfs-cli" >&2
|
||||
printf '%s\n' "$archive_members" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]]; then
|
||||
cli_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$cli_dir"' EXIT
|
||||
unzip -q "$package_file" rustfs-cli -d "$cli_dir"
|
||||
"$cli_dir/rustfs-cli" --help >/dev/null
|
||||
fi
|
||||
|
||||
- name: Verify packaged console
|
||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user