Update zip command in build workflow #22
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 | |
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 }} | |
- 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: | | |
zip target/${{ matrix.target }}.zip target/${{ matrix.target }}/release/jbox -r assets | |
- name: zip for windows | |
if: matrix.target == 'x86_64-pc-windows-msvc' || matrix.target == 'x86_64-pc-windows-gnu' | |
run: | | |
powershell compress-archive -Path target/${{ matrix.target }}/release/jbox.exe -Path assets/ -DestinationPath target/${{ matrix.target }}.zip | |
- 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 }}.zip | |
#- 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 |