name:cross-releaseon:workflow_dispatch:push:tags:- '**'env:# The project name specified in your Cargo.tomlPROJECT_NAME:action-demojobs:release:runs-on:${{ matrix.runner }}strategy:matrix:# You can add more, for any target you'd like!include:- name:linux-amd64-gnurunner:ubuntu-latesttarget:x86_64-unknown-linux-gnu- name:linux-amd64-muslrunner:ubuntu-latesttarget:x86_64-unknown-linux-musl- name:macos-amd64runner:macos-latesttarget:x86_64-apple-darwin- name:macos-arm64runner:macos-latesttarget:aarch64-apple-darwin- name:windows-amd64runner:windows-latesttarget:x86_64-pc-windows-msvc- name:windows-gnurunner:windows-latesttarget:x86_64-pc-windows-gnusteps:- name:Checkoutuses:actions/checkout@v3- name:Install Rustuses:dtolnay/rust-toolchain@stablewith:targets:"${{ matrix.target }}"- name:Build Binaryrun:cargo build --verbose --locked --release --target ${{ matrix.target }}- name:Release Binaryshell:bashrun:| BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
ls target/*
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"
tar -zcf "${PROJECT_NAME}.tar.gz" "${BIN_OUTPUT}"
# Move the built binary where you want it
# mv "${BIN_OUTPUT}" "./<your-destination>/${BIN_RELEASE}"- name :upload binaryuses:actions/upload-artifact@masterif:always()with:name:${{ matrix.name }}path:./*.tar.gz