name: Release
on:
release:
types: [published]
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: dk
- target: aarch64-apple-darwin
os: macos-latest
artifact: dk
- target: x86_64-apple-darwin
os: macos-latest
artifact: dk
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: dk.exe
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- run: cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: dk-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact }}
publish-crate:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
upload-binaries:
name: Upload Release Binaries
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
- name: Upload binaries to release
uses: softprops/action-gh-release@v2
with:
files: |
dk-x86_64-unknown-linux-gnu/dk
dk-aarch64-apple-darwin/dk
dk-x86_64-apple-darwin/dk
dk-x86_64-pc-windows-msvc/dk.exe