# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build KCC for windows 7

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

    # Don't trigger if it's just a documentation update
    paths-ignore:
      - '**.md'
      - '**.MD'
      - '**.yml'
      - '**.sh'
      - 'docs/**'
      - 'Dockerfile'
      - 'LICENSE'
      - '.gitattributes'
      - '.gitignore'
      - '.dockerignore'

jobs:
  build:
    runs-on: windows-2022
    env:
      WINDOWS_7: 1
    steps:
      - uses: actions/checkout@v5
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: 3.8
          cache: 'pip'
      - name: Install dependencies
        env:
          PYINSTALLER_COMPILE_BOOTLOADER: 1
        run: |
          python -m pip install --upgrade pip setuptools wheel
          pip install -r requirements-win7.txt
          pip install certifi pyinstaller --no-binary pyinstaller
          .\gen_ui_files.bat
      - name: build binary
        run: |
          python setup.py build_binary
      - name: upload-unsigned-artifact
        id: upload-unsigned-artifact
        uses: actions/upload-artifact@v4
        with:
          name: windows-build
          path: dist/*.exe
      - name: Release
        uses: softprops/action-gh-release@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          prerelease: true
          generate_release_notes: true
          files: |
            LICENSE.txt
            dist/*.exe
