Workflow file for this run
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: Build and release uplink binaries | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-release: | |
name: Build release for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [linux, macos, linux-arm-gnu, windows] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
- build: macos | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
- build: macos-m1 | |
os: macos-latest | |
rust: stable | |
target: aarch64-apple-darwin | |
- build: linux-arm-gnu | |
os: ubuntu-latest | |
rust: 1.69.0 | |
target: armv7-unknown-linux-gnueabihf | |
- build: linux-aarch-musl | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-musl | |
- build: linux-aarch-gnu | |
os: ubuntu-latest | |
rust: 1.69.0 | |
target: aarch64-unknown-linux-gnu | |
- build: windows | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-pc-windows-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Use Cross | |
shell: bash | |
run: | | |
cargo install cross | |
echo "CARGO=cross" >> $GITHUB_ENV | |
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV | |
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | |
- name: Build release binary | |
run: cross build --verbose --release ${{ env.TARGET_FLAGS }} | |
- name: Strip release binary (linux and macos) | |
if: matrix.build == 'linux' || matrix.build == 'macos' || matrix.build == 'macos-m1' | |
run: strip "target/${{ matrix.target }}/release/uplink" | |
- name: Strip release binary (armv7) | |
if: matrix.build == 'linux-arm-gnu' | |
run: | | |
docker run --rm -v \ | |
"$PWD/target:/target:Z" \ | |
rustembedded/cross:armv7-unknown-linux-gnueabihf \ | |
arm-linux-gnueabihf-strip \ | |
/target/armv7-unknown-linux-gnueabihf/release/uplink | |
- name: Strip release binary (aarch-musl) | |
if: matrix.build == 'linux-aarch-musl' | |
run: | | |
docker run --rm -v \ | |
"$PWD/target:/target:Z" \ | |
rustembedded/cross:aarch64-unknown-linux-musl \ | |
aarch64-linux-musl-strip \ | |
/target/aarch64-unknown-linux-musl/release/uplink | |
- name: Strip release binary (aarch-gnu) | |
if: matrix.build == 'linux-aarch-gnu' | |
run: | | |
docker run --rm -v \ | |
"$PWD/target:/target:Z" \ | |
rustembedded/cross:aarch64-unknown-linux-gnu \ | |
aarch64-linux-gnu-strip \ | |
/target/aarch64-unknown-linux-gnu/release/uplink | |
- name: Rename ${{ matrix.target }} binary | |
if: matrix.build != 'windows' | |
run: mv "target/${{ matrix.target }}/release/uplink" "uplink-${{ matrix.target }}" | |
- name: Rename ${{ matrix.target }} binary | |
if: matrix.build == 'windows' | |
run: mv "target/${{ matrix.target }}/release/uplink.exe" "uplink-${{ matrix.target }}.exe" | |
- name: Upload release archive | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: uplink* |