name: Release
on:
push:
tags:
- 'v*'
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
plan:
runs-on: ubuntu-latest
outputs:
val: ${{ steps.plan.outputs.val }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh
- id: plan
run: cargo dist plan --output-format=json > plan.json && echo "val=$(cat plan.json | jq -c .)" >> $GITHUB_OUTPUT
build:
needs: plan
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh
- name: Build
run: cargo dist build --tag=${{ github.ref_name }}
publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh
- name: Publish
run: cargo dist publish --tag=${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}