name: release

on:
  release:
    types: [published]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - id: package-version
        uses: martinbeentjes/npm-get-version-action@v1.3.1
      - uses: josephbmanley/butler-publish-itchio-action@v1.0.3
        env:
          BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }}
          CHANNEL: win-linux-mac-stable
          ITCH_GAME: bitsy-hacks
          ITCH_USER: seansleblanc
          PACKAGE: dist
          VERSION: ${{ steps.package-version.outputs.current-version}}
      - name: update Borksy
        uses: peter-evans/repository-dispatch@v3
        with:
          token: ${{ secrets.REPO_READ_TOKEN }}
          repository: Ayolland/borksy
          event-type: update-hacks
