name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: dedups-linux-x86_64
binary_name: dedups
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: dedups-macos-x86_64
binary_name: dedups
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: dedups-macos-aarch64
binary_name: dedups
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: dedups-windows-x86_64.exe
binary_name: dedups.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cargo build --release --target ${{ matrix.target }} --features linux
env:
RUSTFLAGS: "-C target-cpu=native"
- name: Build (macOS)
if: matrix.os == 'macos-latest'
run: cargo build --release --target ${{ matrix.target }} --features linux
env:
RUSTFLAGS: "-C target-feature=+aes,+neon"
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
cp ${{ matrix.binary_name }} ../../${{ matrix.artifact_name }}
chmod +x ../../${{ matrix.artifact_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: target/${{ matrix.artifact_name }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: List downloaded artifacts
run: ls -la
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
dedups-linux-x86_64
dedups-macos-x86_64
dedups-macos-aarch64
dedups-windows-x86_64.exe
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}