<%- for platform, pkg_type, display_name, runner_type in (
                                                          ("linux", "rpm", "RPM", "self-hosted"),
                                                          ("linux", "deb", "DEB", "self-hosted"),
                                                          ("windows", "windows", "Windows", "github-hosted"),
                                                          ("macos", "macos", "macOS", "github-hosted"),
                                                        ) %>

  <%- for backend in ("onedir", "src") %>
  <%- set job_name = "build-{}-pkgs-{}".format(pkg_type, backend) %>
  <%- if backend == "src" %>
    <%- do conclusion_needs.append(job_name) %>
  <%- endif %>

  <{ job_name }>:
    name: Build Packages
    if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-pkgs'] && fromJSON(needs.prepare-workflow.outputs.runners)['<{ runner_type }>'] }}
    needs:
      - prepare-workflow
      - build-salt-onedir-<{ platform }>
    uses: ./.github/workflows/build-<{ pkg_type }>-packages.yml
    with:
      salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
      cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
      relenv-version: "<{ relenv_version }>"
      python-version: "<{ python_version }>"
      source: "<{ backend }>"
    <%- if pkg_type in ("macos", "windows") and gh_environment %>
      environment: <{ gh_environment }>
      <%- if pkg_type == "macos" %>
      sign-packages: true
      <%- else %>
      sign-packages: <% if gh_environment == 'nightly' -%> false <%- else -%> ${{ inputs.sign-windows-packages }} <%- endif %>
      <%- endif %>
    secrets: inherit
    <%- endif %>

  <%- endfor %>
<%- endfor %>
