Files @ r25011:61d28a13bb41
Branch filter:

Location: cpp/openttd-patchpack/source/.github/workflows/preview_push.yml

Patric Stout
Remove: [Video] no longer draw in a thread

Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.

Additionally, putting the drawing routine in a thread was only
done for a few targets.

Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
name: Preview push

on:
  pull_request_target:
    types:
    - synchronize

jobs:
  check_new_preview:
    name: Check preview needs update

    runs-on: ubuntu-20.04

    steps:
    - name: Check if earlier preview exists
      id: earlier_preview
      uses: octokit/request-action@v2.x
      with:
        route: GET /repos/{owner}/{repo}/deployments
        owner: ${{ github.event.repository.owner.login }}
        repo: ${{ github.event.repository.name }}
        environment: preview-pr-${{ github.event.number }}
        per_page: 1
      env:
        GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}

    - if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]'
      name: Check for preview label
      id: preview_label
      uses: octokit/request-action@v2.x
      with:
        route: GET /repos/{owner}/{repo}/issues/{issue_number}/labels
        owner: ${{ github.event.repository.owner.login }}
        repo: ${{ github.event.repository.name }}
        issue_number: ${{ github.event.number }}
      env:
        GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}

    - if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
      name: Create deployment
      id: deployment
      uses: octokit/request-action@v2.x
      with:
        route: POST /repos/{owner}/{repo}/deployments
        mediaType: |
          previews:
          - ant-man
          - flash
        owner: ${{ github.event.repository.owner.login }}
        repo: ${{ github.event.repository.name }}
        ref: ${{ github.event.pull_request.head.sha }}
        task: deploy:preview
        auto_merge: false
        required_contexts: "[]"
        environment: preview-pr-${{ github.event.number }}
        description: "Preview for Pull Request #${{ github.event.number }}"
      env:
        GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}

    - if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
      name: Trigger 'preview build'
      uses: peter-evans/repository-dispatch@v1
      with:
        token: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
        event-type: "Preview build #${{ github.event.number }}"
        client-payload: '{"folder": "pr${{ github.event.number }}", "sha": "${{ github.event.pull_request.head.sha }}", "deployment_id": "${{ fromJson(steps.deployment.outputs.data).id }}"}'