test_gen 0.2.3

A comprehensive function-like macro, for concisely defining parameterized tests.
Documentation
name: CD

on:
  release:
    types:
      - published
  workflow_dispatch:
    inputs:
      dry_run:
        description: 'Dry Run'
        type: boolean
        default: true
      args:
        description: 'Command Arguments'
        required: false
        type: string
        default: ''

env:
  CARGO_TERM_COLOR: always

jobs:
  validate-release:
    # Restricts the workflow to running, only if:
    # 1. It isn't potentially expose a token, and is against the main branch
    # 2. It's triggered by a release
    if: ${{ !contains(inputs.args, '--token') && github.ref_name == 'main' || github.event_name == 'release' }}
    uses: ./.github/workflows/ci.yml
  publish-release:
    needs: validate-release
    runs-on: ubuntu-latest
    env:
      ARGS: ${{ inputs.args }}
      DRY_RUN: ${{ inputs.dry_run }}
      RELEASE: ${{ github.event_name == 'release' }}
      CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - name: Cargo Cache
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin
            ~/.cargo/registry/index
            ~/.cargo/registry/cache
            ~/.cargo/git/db
            target/
          key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.toml') }}
          restore-keys: |
            ${{ runner.os }}-cargo-stable-
            ${{ runner.os }}-cargo-
            ${{ runner.os }}-
      - name: Run Release
        run: |
          if $RELEASE == true; then
            cargo publish --verbose
          else  
            if $DRY_RUN == true; then
              ARGS="$ARGS --dry-run"
            fi

            cargo publish $ARGS
          fi