Skip to content

Rust build-and-release #71

Rust build-and-release

Rust build-and-release #71

name: Rust build-and-release
on:
workflow_dispatch: # Manually triggered
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config
- name: Set OpenSSL environment variables
run: |
export OPENSSL_DIR=/usr/lib/ssl
export OPENSSL_LIB_DIR=$OPENSSL_DIR/lib
export OPENSSL_INCLUDE_DIR=$OPENSSL_DIR/include
- name: Configure pkg-config for cross-compilation
run: |
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu
export PKG_CONFIG_PATH=$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig
- name: Install Rust toolchain
run: |
rustup toolchain install stable
rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Get Version from Cargo.toml
id: cargo_version
run: |
THE_VERSION_STRING=$(cargo pkgid | cut -d@ -f2 | cut -d: -f2)
echo "::set-output name=t_cargo_version::$THE_VERSION_STRING"
- name: Zip Linux Binary
uses: vimtor/action-zip@v1
with:
files: /target/release/limonium
dest: /target/release/limonium-${{ matrix.target }}.zip
- name: Deploy Release With Artifact
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.cargo_version.outputs.t_cargo_version }}"
prerelease: false
files: |
target/release/limonium-${{ matrix.target }}.zip