name: Release new version

on:
  push:
    tags:
      - "*"

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always

jobs:
  release:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Build release
        run: "cargo build --release"
      - uses: katyo/publish-crates@v2
        name: Publish on crates.io
        with:
          registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
      - uses: softprops/action-gh-release@v1
        name: Create GitHub Release
        with:
          files: |
            target/release/shadower
            LICENSE
