Skip to content

attempted to fix binary creation in CI for cli #33

attempted to fix binary creation in CI for cli

attempted to fix binary creation in CI for cli #33

Workflow file for this run

name: Release Rust CLI
on:
push:
jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- name: windows
rust_target: x86_64-pc-windows-gnu
archive: zip
- name: linux-tar-gz
rust_target: x86_64-unknown-linux-musl
archive: tar.gz
- name: linux-tar-xz
rust_target: x86_64-unknown-linux-musl
archive: tar.xz
- name: linux-tar-zst
rust_target: x86_64-unknown-linux-musl
archive: tar.zst
- name: macos
rust_target: x86_64-apple-darwin
archive: zip
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust and Cross
run: |
rustup install stable
rustup target add ${{ matrix.target.rust_target }}
cargo install cross
- name: Build ro-crate-rs-cli
run: |
cd cli
cross build --release --target=${{ matrix.target.rust_target }}
mkdir -p dist/${{ matrix.target.name }}
- name: Package Binary
run: |
cd cli
BINARY=target/${{ matrix.target.rust_target }}/release/rocraters
ARCHIVE=dist/${{ matrix.target.name }}/rocraters-${{ matrix.target.rust_target }}.${{ matrix.target.archive }}
if [[ "${{ matrix.target.archive }}" == "zip" ]]; then
zip -j $ARCHIVE $BINARY
elif [[ "${{ matrix.target.archive }}" == "tar.gz" ]]; then
tar -czvf $ARCHIVE -C target/${{ matrix.target.rust_target }}/release rocraters
elif [[ "${{ matrix.target.archive }}" == "tar.xz" ]]; then
tar -cJvf $ARCHIVE -C target/${{ matrix.target.rust_target }}/release rocraters
elif [[ "${{ matrix.target.archive }}" == "tar.zst" ]]; then
tar --zstd -cvf $ARCHIVE -C target/${{ matrix.target.rust_target }}/release rocraters
fi
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: cli-tool-${{ matrix.target.name }}-${{ matrix.target.archive }}
path: cli-tool/dist/${{ matrix.target.name }}/*