From 8516e8a4247a24d0f16d595770cddb42717c3082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Wyszy=C5=84ski?= Date: Sun, 1 Dec 2024 16:21:39 +0100 Subject: [PATCH] ci: improve build and package step in release workflow - Merge build and package steps into single step - Use export for pkg-config vars to share between commands - Add comment about Cross.toml passthrough - Simplify build step comments for clarity --- .github/workflows/release.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a0736c..4ce4554 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,13 +88,14 @@ jobs: - name: Install cargo-deb run: cargo install cargo-deb - - name: Build + - name: Build and package env: PKG_CONFIG_ALLOW_CROSS: "1" run: | if [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then - # Native build uses standard system paths + # Native build cargo build --release --target ${{ matrix.target }} + cargo deb --target ${{ matrix.target }} else # Cross compilation requires special paths if [ "${{ matrix.target }}" = "armv7-unknown-linux-gnueabihf" ]; then @@ -102,15 +103,16 @@ jobs: elif [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then PKG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig" fi - PKG_CONFIG_PATH="$PKG_PATH" \ - PKG_CONFIG_SYSROOT_DIR="/usr" \ - PKG_CONFIG_LIBDIR="$PKG_PATH" \ + + # Vars will be passed to both commands thanks to passthrough in Cross.toml + export PKG_CONFIG_PATH="$PKG_PATH" + export PKG_CONFIG_SYSROOT_DIR="/usr" + export PKG_CONFIG_LIBDIR="$PKG_PATH" + cross build --release --target ${{ matrix.target }} + cargo deb --target ${{ matrix.target }} fi - - name: Build deb package - run: cargo deb --target ${{ matrix.target }} - - name: Upload artifacts uses: actions/upload-artifact@v4 with: