Update dependencies in build.yml #10
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 | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
pull_request_review: | |
workflow_call: | |
inputs: | |
tag-name: | |
required: true | |
type: string | |
jobs: | |
build: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [aarch64-unknown-linux-gnu, aarch64-unknown-linux-musl] | |
use-cross: [true] | |
include: | |
- target: x86_64-unknown-linux-gnu | |
use-cross: false | |
- target: x86_64-unknown-linux-musl | |
use-cross: false | |
- os: macos-12 | |
target: aarch64-apple-darwin | |
- os: macos-12 | |
target: x86_64-apple-darwin | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
- os: windows-2022 | |
target: x86_64-pc-windows-gnu | |
runs-on: ${{ matrix.os || 'ubuntu-22.04'}} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
defaults: | |
run: | |
shell: bash -xe {0} | |
steps: | |
- name: Install dependencies | |
if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get install -y libasound2 libudev-dev --no-install-recommends | |
- name: Install musl tools | |
if: matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
sudo apt-get install -y musl-tools libasound2 libudev-dev --no-install-recommends | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
key: ${{ matrix.target }} | |
- name: Install cross | |
if: ${{ !matrix.os && matrix.use-cross }} | |
uses: taiki-e/install-action@3ed9916b5427bc0679b294607ea47d1d8007b53f # v2.25.7 | |
with: | |
tool: cross | |
- run: ${{ (!matrix.os && matrix.use-cross) && 'cross' || 'cargo' }} build --locked --release --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
target/${{ matrix.target }}/release/jbox | |
target/${{ matrix.target }}/release/jbox.exe | |
- name: Upload to release | |
if: ${{ inputs.tag-name }} | |
working-directory: target/${{ matrix.target }}/release/ | |
run: | | |
if [ -e jbox.exe ]; then | |
filename="jbox-${{ inputs.tag-name }}-${{ matrix.target }}.exe" | |
mv jbox.exe "$filename" | |
gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber | |
else | |
filename="jbox-${{ inputs.tag-name }}-${{ matrix.target }}" | |
mv jbox "$filename" | |
gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber | |
fi |