name: Build EDMC for Windows

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:

jobs:
  test:
    name: Build EDMC
    runs-on: windows-2019

    defaults:
      run:
        shell: powershell

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: "3.9.4"
          architecture: "x86"

      - name: Install python tools
        run: |
          pip install wheel
          pip install -r requirements-dev.txt

      - name: Download winsparkle
        run: |
          Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.7.0/WinSparkle-0.7.0.zip -OutFile out.zip
          Expand-Archive out.zip
          Move-Item 'out\WinSparkle-0.7.0\Release\*' '.\'

      - name: Build EDMC
        run: |
          python setup.py py2exe

      - name: Upload build files
        uses: actions/upload-artifact@v2
        with:
          name: Built files
          path: EDMarketConnector_win*.msi
