waco 0.0.1

Command line tool to manage WildFly containers.
name: Release

permissions:
  # TODO: once `releases: write` is supported, use it instead.
  contents: write

on:
  push:
    tags:
      - v[0-9]+.*

env:
  CARGO_INCREMENTAL: 0
  CARGO_NET_RETRY: 10
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: full
  RUSTFLAGS: -D warnings
  RUSTUP_MAX_RETRIES: 10

defaults:
  run:
    shell: bash --noprofile --norc -CeEuxo pipefail {0}

jobs:
  create-release:
    if: github.repository_owner == 'hpehl'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: taiki-e/create-gh-release-action@v1.9.1
        with:
          title: '$version'
          changelog: CHANGELOG.md
          token: ${{ secrets.GITHUB_TOKEN }}
  publish-crate:
    if: github.repository_owner == 'hpehl'
    needs: create-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo publish --token ${CRATES_TOKEN}
        env:
          CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
  upload-assets:
    if: github.repository_owner == 'hpehl'
    needs: create-release
    name: ${{ matrix.target }}
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-apple-darwin
            os: macos-latest
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: taiki-e/upload-rust-binary-action@v1
        with:
          bin: waco
          target: ${{ matrix.target }}
          tar: all
          zip: windows
          token: ${{ secrets.GITHUB_TOKEN }}