Skip to content

ci(release): use stable toolchain — Cargo.lock v4 requires 1.78+ #3

ci(release): use stable toolchain — Cargo.lock v4 requires 1.78+

ci(release): use stable toolchain — Cargo.lock v4 requires 1.78+ #3

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use_cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use_cross: true
- os: macos-latest
target: x86_64-apple-darwin
use_cross: false
- os: macos-latest
target: aarch64-apple-darwin
use_cross: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install cross
if: matrix.use_cross
run: cargo install cross --locked
- name: Build
shell: bash
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross build --release --locked --target ${{ matrix.target }}
else
cargo build --release --locked --target ${{ matrix.target }}
fi
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ matrix.target }}.tar.gz spma
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ matrix.target }}.tar.gz
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v2
with:
prerelease: ${{ contains(github.ref, '-rc') }}
files: '*/*.tar.gz'
publish:
needs: release
if: ${{ !contains(github.ref, '-rc') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Publish to crates.io
run: cargo publish --locked --token ${{ secrets.CARGO_TOKEN }}