name: Publish
on:
push:
tags: [ "*" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
asset_name: modelscope-ng-linux-amd64.tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
asset_name: modelscope-ng-windows-amd64.tar.gz
- os: macos-latest
target: aarch64-apple-darwin
asset_name: modelscope-ng-macos-arm64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install musl tools
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build -r --bin modelscope-ng --target ${{ matrix.target }}
- name: Compress binary
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ${{ matrix.asset_name }} modelscope-ng.exe
shell: bash
- name: Compress binary
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ${{ matrix.asset_name }} modelscope-ng
shell: bash
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
files: |
target/${{ matrix.target }}/release/modelscope-ng-linux-amd64.tar.gz
target/${{ matrix.target }}/release/modelscope-ng-windows-amd64.tar.gz
target/${{ matrix.target }}/release/modelscope-ng-macos-arm64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}