name: WUIsBack Nightly AutoBuilder

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: windows-latest
    steps:
    - name: Install NSIS
      run: |
        iwr -useb get.scoop.sh -outfile 'install.ps1'
        .\install.ps1 -RunAsAdmin
        scoop update
        scoop bucket add extras
        scoop install nsis
    - name: Download latest DLL
      run: |
        md .\Release
        md .\x64\Release
        iwr http://fritzbox3272.controlliamo.com/WUIsBack/dll/LegacyUpdate32.dll -outfile '.\Release\LegacyUpdate.dll'
        iwr http://fritzbox3272.controlliamo.com/WUIsBack/dll/LegacyUpdate64.dll -outfile '.\x64\Release\LegacyUpdate.dll'
    - name: Compile WUIsBack
      run: |
        makensis "%~dp0\setup\setup.nsi"
    - name: Upload Nightly Build
      uses: actions/upload-artifact@v4
      with:
        name: WUIsBack
        path: setup/WUIsBack-latest.exe
