bevygen 0.1.0

parked: opinionated bevy game design cli
Documentation
name: Release Crate

on:
  push:
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+*"
  workflow_dispatch:
    inputs:
      version:
        description: 'Version - in the form of v1.2.3'
        required: true
        type: string

permissions:
    contents: write

jobs:
  get-version:
    runs-on: ubuntu-latest
    steps:
      - name: Get tag
        id: tag
        run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
    outputs:
      version: ${{ inputs.version || steps.tag.outputs.tag }}

  build-binaries:
    name: Publish for ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    needs: get-version
    env:
      VERSION: ${{needs.get-version.outputs.version}} # idk why I can't just use this directly under release_name
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            executable: bevygen
            asset: bevygen_x86_64-unknown-linux-gnu
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            executable: bevygen.exe
            asset: bevygen_x86_64-pc-windows-msvc.exe
          - os: macos-latest
            target: aarch64-apple-darwin
            executable: bevygen
            asset: bevygen_aarch-apple-darwin
    permissions:
      contents: write
      packages: write
    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Set up Rust
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: stable
        targets: ${{ matrix.target }}

    - name: Build
      run: cargo build --release --locked --target ${{ matrix.target }}

    - name: Upload to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: target/${{ matrix.target }}/release/${{ matrix.executable }}
        asset_name: ${{ matrix.asset }}
        release_name: ${{ env.VERSION }}
        tag: ${{ github.ref }}
        overwrite: true

  release:
    name: Release on crates.io
    runs-on: ubuntu-latest
    needs: build-binaries

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --locked