branches:
  only:
    - binaries

install:
  - curl -O 'http://commondatastorage.googleapis.com/leafo/lua5_1_4_Win32_dll8_lib.zip'
  - curl -O 'http://commondatastorage.googleapis.com/leafo/lua5_1_4_Win32_bin.zip'
  - 7z x lua5_1_4_Win32_dll8_lib.zip
  - 7z x lua5_1_4_Win32_bin.zip -aos
  - set PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin;%PATH%
  - dir .

build_script:
  - make

test_script:
  - moon.exe test.moon
  - moonc.exe test.moon
  - lua5.1.exe -e "assert(require('moonscript')); print(require('moonscript.version').version)"

after_build:
  - 7z a moonscript-%APPVEYOR_REPO_COMMIT%.zip moonscript.dll lua51.dll lua5.1.dll moon.exe moonc.exe LICENSE README.txt
  - dir

artifacts:
  - path: moonscript-$(appveyor_repo_commit).zip

deploy:
  - provider: GitHub
    artifact: /moonscript.*\.zip/
    auth_token:
      secure: ow29ymI+HSG5ZGMF0vtyPTFQsRnOvebxAI0FXChgfJ327UOnZcXImQ0LN7DW7ImF
    on:
      branch: binaries
      appveyor_repo_tag: true
