WIP #927
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy unix | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
TARGET: x86_64-unknown-linux-gnu | |
SUFFIX: linux-desktop | |
- os: ubuntu-22.04 | |
TARGET: armv7-unknown-linux-gnueabihf | |
SUFFIX: armv7 | |
- os: ubuntu-22.04 | |
TARGET: aarch64-unknown-linux-gnu | |
SUFFIX: aarch64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set directory to safe for git | |
# Note: Required by vergen (https://crates.io/crates/vergen) | |
run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
- name: Use cached dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: "${{ matrix.os }}-${{ matrix.TARGET }}-${{ hashFiles('**/Cargo.lock') }}" | |
shared-key: "shared" | |
- name: Install build dependencies - Rustup | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile minimal --target ${{ matrix.TARGET }} -y | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
- name: Install build dependencies - Cross | |
run: cargo install cross | |
- name: Building for ${{ matrix.os }} ${{ matrix.target }} (${{ matrix.SUFFIX }}) | |
run: cross build --release --locked --target ${{matrix.target}} --verbose | |
- name: Prepare files | |
run: | | |
mkdir -p upload | |
cp target/${{ matrix.TARGET }}/release/mavlink-camera-manager upload/mavlink-camera-manager-${{ matrix.SUFFIX }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: mavlink-camera-manager-${{ matrix.SUFFIX }} | |
path: upload/* | |
- uses: svenstaro/upload-release-action@v2 | |
name: Upload binaries to release | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')}} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: 'upload/mavlink-camera-manager-*' | |
asset_name: mavlink-camera-manager-${{ matrix.SUFFIX }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |