version: git-{branch}-{build}
image: Visual Studio 2017

configuration:
- fast

platform:
- x64

before_build:
  - cmd: >-
      set BUILD_PATH=shell\linux
      
      set EXTRA_PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin\
      
      set PATH=%EXTRA_PATH%;%PATH%
      
      if not exist %BUILD_PATH% (mkdir %BUILD_PATH%)
     
      cd %BUILD_PATH%
      
build_script:
  - cmd: >-
      if "%CONFIGURATION%"=="fast" (mingw32-make platform=win32)

after_build:
  - cmd: >-      
      if "%CONFIGURATION%"=="fast" (cd ..\.. && set EXE_PATH=shell\linux\nosym-reicast.exe)
      
      mkdir artifacts
      
      move %EXE_PATH% artifacts\flycast-win_%PLATFORM%-%CONFIGURATION%-%APPVEYOR_REPO_COMMIT%.exe
      
artifacts:
  - path: artifacts
    name: flycast-win_$(PLATFORM)-$(CONFIGURATION)-$(APPVEYOR_REPO_COMMIT)
deploy:
- provider: S3
  access_key_id: AKIAJOZQS4H2PHQWYFCA
  secret_access_key:
    secure: Y/QobuGrBsa137sbi9a+UnvSLqpWITTCp5yFTgDJ4i1Gduyi9V7i/g3zLZ4s2J7d
  bucket: flycast-builds
  folder: 'win/heads/$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT)'
  artifact: flycast-win_$(PLATFORM)-$(CONFIGURATION)-$(APPVEYOR_REPO_COMMIT)
  region: us-east-2
  set_public: true
