Files
pipewire-soundpad/.github/workflows/build-release.yml
T
arabian 6feec98b4c Update build-release.yml
try to fix zip creation
2025-12-16 21:08:47 +03:00

87 lines
2.7 KiB
YAML

name: Rust Release
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'Tag to attach assets to (e.g. v1.0.0)'
required: true
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# если запускаешь вручную — укажи тег, иначе возьмётся github.ref
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
zip jq \
libpipewire-0.3-dev \
libclang-dev \
libasound2-dev
- name: Extract all binary names
id: cargo-meta
run: |
BIN_NAMES=$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[0].targets[] | select(.kind[] | contains("bin")) | .name')
echo "bin_names<<EOF" >> $GITHUB_OUTPUT
echo "$BIN_NAMES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build all release binaries
run: cargo build --release --locked
- name: Package all binaries into one archive
shell: bash
run: |
TAG_NAME="${{ github.event.inputs.tag || github.ref_name }}"
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
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
files: |
pwsp-*.zip