builds godot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: "Setup"
description: "Setup the environment for building"

inputs:
  ref:
    description: Which ref to build
    required: true

runs:
  using: "composite"
  steps:
    - name: Check if clean
      id: clean
      run: |
        if [[ -d godot ]]; then echo "clean=false" >> $GITHUB_OUTPUT;
        else echo "clean=true" >> $GITHUB_OUTPUT; fi
      shell: bash

    - uses: actions/checkout@v3
      if: steps.clean.outputs.clean == 'true'
      with:
        repository: godotengine/godot
        ref: ${{ inputs.ref }}
        path: "godot"

    - uses: actions/checkout@v3
      if: steps.clean.outputs.clean == 'true'
      with:
        path: "repo"

    - name: Setup Python
      if: steps.clean.outputs.clean == 'true'
      uses: actions/setup-python@v4
      with:
        python-version: 3.9

    - name: Apply patches to godot
      if: steps.clean.outputs.clean == 'true'
      run: |
        # Patch godot
        (cd repo && mv "${{ env.modules }}" ../godot/custom.py && mv patches ../godot)
        cd godot
        for patch in patches/*; do git apply --ignore-whitespace "$patch" || err="$patch"; done
        if [[ -n $err ]]; then
          echo "::error file={${err}}::Go update your patch"
          exit 1
        fi
      shell: bash