name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: vshadow-info.exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: vshadow-info
- target: x86_64-apple-darwin
os: macos-latest
artifact: vshadow-info
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary (Windows)
if: matrix.os == 'windows-latest'
run: |
cp target/${{ matrix.target }}/release/vshadow-info.exe vshadow-info-${{ github.ref_name }}-windows.exe
- name: Rename binary (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cp target/${{ matrix.target }}/release/vshadow-info vshadow-info-${{ github.ref_name }}-linux
chmod +x vshadow-info-${{ github.ref_name }}-linux
- name: Rename binary (macOS)
if: matrix.os == 'macos-latest'
run: |
cp target/${{ matrix.target }}/release/vshadow-info vshadow-info-${{ github.ref_name }}-macos
chmod +x vshadow-info-${{ github.ref_name }}-macos
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vshadow-info-${{ matrix.os }}
path: vshadow-info-${{ github.ref_name }}*
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: List files
run: ls -la
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: vshadow-info-*