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
          apt-get update && apt-get install -y -q zip
          cargo install cargo-vcpkg && cargo vcpkg -v build
          cargo build
          cargo build --release
      - name: Build Libretro
        run: |
          cd frontends/libretro
          cargo build
          cargo build --release
      - name: Create Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            target/release/boytacean-sdl
            target/release/libboytacean.so
            target/release/libboytacean_libretro.so
