Skip to content

Commit

Permalink
ci: improve build and package step in release workflow
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
aljen committed Dec 1, 2024
1 parent 526418a commit 8516e8a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,31 @@ 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
PKG_PATH="/usr/lib/arm-linux-gnueabihf/pkgconfig"
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:
Expand Down

0 comments on commit 8516e8a

Please sign in to comment.