environment:
  npm_version: latest
  github_release_token:
    secure: hxsvJ4kPWab0alyx7GyJLh7aWeqlXhON9GmvZFh5ywyGS1WO8lFqNn8bx8HmlG3H
  matrix:
    - nodejs_version: '14'
    - nodejs_version: '13'
    - nodejs_version: '12'
    - nodejs_version: '10'

platform:
  - x86
  - x64

os: Visual Studio 2015

artifacts:
  - path: build\**\*.tar.gz
    name: libxml_binary

install:
  - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM
  - npm --version
  - npm config set msvs_version 2015
  - npm config set python C:\Python27\python.exe
  - yarn global add node-pre-gyp

build_script:
  - set npm_config_msvs_version=2015
  - set npm_config_build_from_source=true
  - yarn --frozen-lockfile

test_script:
  - yarn test
  - yarn lint
  - yarn tsd

after_test:
  - node-pre-gyp package 2>&1

deploy:
  - provider: GitHub
    release: $(APPVEYOR_REPO_TAG_NAME)
    artifact: libxml_binary
    auth_token: $(github_release_token)
    draft: false
    prerelease: false
    on:
      appveyor_repo_tag: true

after_deploy:
  - node-pre-gyp clean
  - set npm_config_fallback_to_build=false
  - yarn --frozen-lockfile
  - yarn test
