- name: Set ADD_REVISION=1 for non-release
  if: ${{ !startsWith(github.ref, 'refs/tags/') }}
  shell: pwsh
  run: echo "ADD_REVISION=1" >> $Env:GITHUB_ENV

- name: Build Haxe
  shell: pwsh
  run: |
    Set-PSDebug -Trace 1
    # stop after any command returns an error
    $PSNativeCommandUseErrorActionPreference = $true
    $ErrorActionPreference = 'Stop'
    opam exec -- make -s -f Makefile.win -j"$env:NUMBER_OF_PROCESSORS" haxe
    opam exec -- make -s -f Makefile.win haxelib
    opam exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco
    cygcheck ./haxe.exe
    cygcheck ./haxelib.exe
    ls ./out

- name: Upload artifact
  uses: actions/upload-artifact@v4
  with:
    name: win${{env.ARCH}}Binaries
    path: out
