tools for exporting godot projects via Github Actions
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Export
description: exports

inputs:
  platform:
    description: The platform (web, linux, mac, android)
    required: true
  extension:
    description: File extension (x86_64, exe, etc)
    required: true
  debug:
    description: Debug build or no (empty string = debug)
    required: false
    default: "false"
  name:
    description: The name ($name.exe) # defaults to $NAME
    required: false

runs:
  using: composite
  steps:
    - name: Setup
      uses: bend-n/godot-actions/.github/actions/setup-godot@main

    - name: Get export name
      id: n
      uses: bend-n/godot-actions/.github/actions/get-export-name@main
      with:
        platform: ${{ inputs.platform }}

    - name: Build
      run: |
        if [[ -f .github/pre_export ]]; then
          echo "::group::Run pre export script"
          chmod +x .github/pre_export
          ./.github/pre_export ${{ inputs.platform }}
          echo "::endgroup::"
        fi
        cd "$PROJECT_PATH"
        p="${{ inputs.platform }}"
        echo "::group::${p^} Build"
        export="--export"
        [[ ${GODOT_VERSION:0:1} -gt 3 ]] && export="--export-release"
        [[ -z $debug ]] && export="--export-debug"
        mkdir -vp build/${{ inputs.platform }}
        n="${{ env.NAME }}"
        [[ -n "${{ inputs.name }}" ]] && n="${{ inputs.name }}"
        timeout 30m godot -v --headless "$export" "${{ steps.n.outputs.export-name }}" "./build/${{ inputs.platform }}/$n.${{ inputs.extension }}"
        echo "::endgroup::"

        if [[ -f .github/post_export ]]; then
          echo "::group::Run post export script"
          chmod +x .github/post_export
          ./.github/post_export ${{ inputs.platform }}
          echo "::endgroup::"
        fi
      shell: bash

    - uses: actions/upload-artifact@v3
      with:
        name: ${{ inputs.platform }}
        path: ${{ env.PROJECT_PATH }}/build/${{ inputs.platform }}
        if-no-files-found: error