Skip to content

chore(main): release 0.0.4 (#14) #56

chore(main): release 0.0.4 (#14)

chore(main): release 0.0.4 (#14) #56

Workflow file for this run

name: build
on:
push:
branches:
- 'main'
- 'develop'
pull_request:
pull_request_review:
workflow_call:
inputs:
tag-name:
required: true
type: string
jobs:
build:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
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'
run: |
sudo apt-get install -y libasound2-dev 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 }}
- run: cargo build --locked --release --target ${{ matrix.target }}
- name: zip for linux and apple
if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-apple-darwin' || matrix.target == 'aarch64-apple-darwin'
run: |
mkdir -p target/${{ matrix.target }}/zip
cp target/${{ matrix.target }}/release/jbox target/${{ matrix.target }}/zip
cp -r assets target/${{ matrix.target }}/zip
cd target/${{ matrix.target }}/zip
tar -czf ../${{ matrix.target }}.tar.gz *
- name: zip for windows
if: matrix.target == 'x86_64-pc-windows-msvc' || matrix.target == 'x86_64-pc-windows-gnu'
run: |
mkdir -p target/${{ matrix.target }}/zip
cp target/${{ matrix.target }}/release/jbox.exe target/${{ matrix.target }}/zip
cp -r assets target/${{ matrix.target }}/zip
cd target/${{ matrix.target }}/zip
powershell Compress-Archive -Path "*" -DestinationPath ../${{ matrix.target }}.zip
- uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: ${{ matrix.target }}
path: |
target/${{ matrix.target }}/zip/jbox*
target/${{ matrix.target }}/zip/assets
- name: Upload to release
if: ${{ inputs.tag-name }}
working-directory: target/${{ matrix.target }}/
run: |
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" || "${{ matrix.target }}" == "x86_64-apple-darwin" || "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
filename="${{ matrix.target }}.tar.gz"
else
filename="${{ matrix.target }}.zip"
fi
gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber