Update build-release.yml

try to fix zip creation
This commit is contained in:
arabian
2025-09-26 00:54:56 +03:00
committed by GitHub
parent 9a1107fb41
commit 974fdc9411
+34 -3
View File
@@ -6,7 +6,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: tag:
description: 'Tag to attach assets to (e.g. 1.0.0)' description: 'Tag to attach assets to (e.g. v1.0.0)'
required: true required: true
jobs: jobs:
@@ -16,6 +16,9 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
# если запускаешь вручную — укажи тег, иначе возьмётся github.ref
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@@ -44,12 +47,40 @@ jobs:
run: cargo build --release --locked run: cargo build --release --locked
- name: Package all binaries into one archive - name: Package all binaries into one archive
shell: bash
run: | run: |
ARCHIVE_NAME="pwsp-${{ github.ref_name }}-linux-x64.zip" TAG_NAME="${{ github.event.inputs.tag || github.ref_name }}"
zip -j "$ARCHIVE_NAME" $(for BIN in ${{ steps.cargo-meta.outputs.bin_names }}; do echo "target/release/$BIN"; done) ARCHIVE_NAME="pwsp-${TAG_NAME}-linux-x64.zip"
echo "Creating archive: $ARCHIVE_NAME"
# заполняем массив путей к файлам построчно
FILES=()
while IFS= read -r BIN; do
# игнорируем пустые строки на всякий случай
[ -z "$BIN" ] && continue
FILES+=("target/release/$BIN")
done <<< "${{ steps.cargo-meta.outputs.bin_names }}"
if [ "${#FILES[@]}" -eq 0 ]; then
echo "No binaries found in cargo metadata output." >&2
exit 1
fi
# проверим наличие файлов и выведем их
for f in "${FILES[@]}"; do
echo "Will add: $f"
if [ ! -f "$f" ]; then
echo "Error: expected binary not found: $f" >&2
exit 1
fi
done
# создаём zip, передавая массив как отдельные аргументы
zip -j "$ARCHIVE_NAME" "${FILES[@]}"
- name: Upload release archive - name: Upload release archive
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
files: | files: |
pwsp-*.zip pwsp-*.zip