name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release-plz.outputs.releases_created }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
id: release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
upload-artifacts:
name: Build and Upload Artifacts
needs: release-plz
if: ${{ needs.release-plz.outputs.releases_created == 'true' }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build and Upload Binary
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: mamoru
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}