name: "Standalone Builds"

on:
  push:
    tags:
      - "v[0-9]+\\.[0-9]+\\.[0-9]+"
      - "v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+"
    branches:
      - master
  pull_request: {}

jobs:
  windows:
    name: "Build Windows standalone version"
    runs-on: windows-latest

    steps:
      - name: "Checkout the repository"
        uses: actions/checkout@v4
        with:
          submodules: true

      - name: "Set up Python"
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: "Build YOGA Windows Standelone Version"
        run: |
          winbuild\builddist.bat

      - name: Archive Windows Build
        uses: actions/upload-artifact@v4
        with:
          name: yoga-vX.X.X_win_standalone_x86-64
          path: yogawin.dist

  linux:
    name: "Build Linux standalone version"
    runs-on: ubuntu-20.04
    steps:
      - name: "Checkout the repository"
        uses: actions/checkout@v4
        with:
          submodules: true

      - name: "Set up Python"
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: "Build YOGA Linux Standelone Version"
        run: |
          linux-bin/build.sh

      - name: "Make the release tarball"
        run: |
          mv yoga-bin.dist yoga-v$(python setup.py --version)_linux_standalone_x86-64
          tar -cvzf yoga-v$(python setup.py --version)_linux_standalone_x86-64.tar.gz yoga-v$(python setup.py --version)_linux_standalone_x86-64

      - name: "Upload Linux tarball"
        uses: actions/upload-artifact@v4
        with:
          name: yoga-vX.X.X_linux_standalone_x86-64
          path: "yoga-*.tar.gz"
