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
64
65
66
name: Web export
description: Web export

inputs:
  git-name:
    description: Name of commiter
    required: true
    default: "bendn"
  git-email:
    description: Email of commiter
    required: true
    default: "[email protected]"
  github-pages:
    description: To gh pages, or not to gh pages, that is the question.
    required: true
    default: "true"

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

    - name: Get export name
      id: get-export-name
      uses: bend-n/godot-actions/.github/actions/get-export-name@main
      with:
        platform: HTML5

    - name: Web Build
      run: |
        echo "::group::Web Build"
        mkdir -vp build/web
        godot -v --path "${{ env.PROJECT_PATH }}" --export "${{ steps.get-export-name.outputs.export-name }}" "$(realpath ./build/web/index.html)"
        echo "::endgroup::"
      shell: bash

    - name: Add extra files
      run: |
        if [[ -f .github/post_export ]]; then
          chmod +x .github/post_export
          ./.github/post_export web
        fi
      shell: bash

    - name: Upload
      uses: actions/upload-artifact@v3
      with:
        name: web
        path: build/web

    - name: Test git repo
      id: is-repo
      run: "echo ::set-output name=is-repo::$(git rev-parse --is-inside-work-tree || echo false)"
      shell: bash

    - name: Deploy
      if: steps.is-repo.outputs.is-repo == 'true' && inputs.github-pages == 'true'
      uses: JamesIves/github-pages-deploy-action@v4
      with:
        branch: gh-pages
        folder: build/web
        git-config-name: ${{ inputs.git-name }}
        git-config-email: ${{ inputs.git-email }}
        single-commit: true
        silent: true