name: Deploy Workflow
on:
  push:
    tags:
      - "*"
jobs:
  build-release:
    name: Build Release
    timeout-minutes: 10
    strategy:
      matrix:
        rust-version: ["1.71.0"]
    runs-on: ubuntu-latest
    container: rust:${{ matrix.rust-version }}
    steps:
      - name: Checkout code from repository
        uses: actions/checkout@v3
      - name: Build Base
        run: |
          cargo build
          cargo build --release
      - name: Build SDL
        run: |
          cd frontends/sdl && cargo install cargo-vcpkg && cargo vcpkg -v build
          cd frontends/sdl && cargo build
          cd frontends/sdl && cargo build --release
      - name: Build Libretro
        run: |
          cd frontends/libretro && cargo build
          cd frontends/libretro && cargo build --release
      - name: Create Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            target/debug/libboytacean.so
            target/release/libboytacean.so
            target/debug/boytacean-sdl
            target/release/boytacean-sdl
            target/debug/libboytacean-libretro.so
            target/release/libboytacean-libretro.so