name: Release

on:
  release:
    types:
      - published

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Remove test files
        run: rm -rf **/*.spec.lua

      - name: Install Aftman
        uses: ok-nick/setup-aftman@v0

      - name: Install packages
        run: wally install

      - name: Build model
        run: rojo build -o reflex.rbxm

      - name: Upload release
        uses: softprops/action-gh-release@v1
        if: ${{ github.event.release }}
        with:
          files: reflex.rbxm
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
