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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: "export"
on:
  workflow_call:
    inputs:
      godot-version:
        description: the godot version (deprecated, this is now parsed out of the image input)
        required: false
        type: string
        # deprecationMessage: This is parsed out of the image input.
        # deprecation message doesnt work, done manually.
      image:
        description: the container to use
        default: ghcr.io/bend-n/godot-2d:3.5
        required: true
        type: string
      export-name:
        description: the name of the exec. ($export-name.exe)
        default: ${{ github.event.repository.name }}
        required: false
        type: string
      platforms:
        description: space seperated platform list
        default: "windows linux web android mac"
        required: false
        type: string
      project-root-path:
        description: the directory that project.godot is in
        default: "."
        required: false
        type: string
      github-pages:
        description: to deploy to github pages or not to deploy to github pages
        default: "true"
        required: false
        type: string # shut
      itch-path:
        description: "the itch.io path to export to, eg: bendn/chess"
        default: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
        required: false
        type: string
    secrets:
      android-keystore-base64:
        description: For signing the apk, will be filled with andrid debug keystore if left blank
        required: false
      android-keystore-password:
        description: For signing the apk, will be filled with andrid debug keystore if left blank
        required: false
      butler-api-key:
        description: For deploying to itch.io
        required: false

env:
  PROJECT_PATH: ${{ inputs.project-root-path }}
  NAME: ${{ inputs.export-name }}

jobs:
  deprecation-warn:
    runs-on: ubuntu-latest
    if: ${{ inputs.godot-version }}
    name: Warn for deprecation
    steps:
      - name: version deprecation warn
        if: ${{ inputs.godot-version }}
        run: echo "::warning title=input.godot-version deprecated::Version now parsed out of input.image"

  linux:
    runs-on: ubuntu-latest
    if: contains(inputs.platforms, 'linux')
    container:
      image: ${{ inputs.image }}
    name: Linux
    steps:
      - name: Get ver
        run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV

      - name: Build
        uses: bend-n/godot-actions/.github/actions/export-linux@main

  windows:
    runs-on: ubuntu-latest
    if: contains(inputs.platforms, 'windows')
    container:
      image: ${{ inputs.image }}
    name: Windows
    steps:
      - name: Get ver
        run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV

      - name: Build
        uses: bend-n/godot-actions/.github/actions/export-windows@main

  mac:
    runs-on: ubuntu-latest
    if: contains(inputs.platforms, 'mac')
    container:
      image: ${{ inputs.image }}
    name: macOS
    steps:
      - name: Get ver
        run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV

      - name: Build
        uses: bend-n/godot-actions/.github/actions/export-mac@main

  web:
    runs-on: ubuntu-latest
    if: contains(inputs.platforms, 'web')
    container:
      image: ${{ inputs.image }}
    name: HTML5
    steps:
      - name: Get ver
        run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV

      - name: Build
        uses: bend-n/godot-actions/.github/actions/export-web@main
        with:
          github-pages: ${{ inputs.github-pages }}

  android:
    runs-on: ubuntu-latest
    if: contains(inputs.platforms, 'android')
    container:
      image: ${{ inputs.image }}
    name: Android
    steps:
      - name: Get ver
        run: echo "GODOT_VERSION=$(echo ${{ inputs.image }} | cut -d':' -f2-)" >> $GITHUB_ENV

      - name: Build
        uses: bend-n/godot-actions/.github/actions/export-android@main
        with:
          android-keystore-base64: ${{ secrets.android-keystore-base64 }}
          android-password: ${{ secrets.android-keystore-password }}

  push-itch:
    needs: [linux, android, windows, mac, web]
    if: always() # run even if the previous jobs were skipped
    name: Push to itch.io
    runs-on: ubuntu-20.04
    steps:
      - name: check
        id: secret
        run: |
          function output() { echo "secret=$1" >> "$GITHUB_OUTPUT"; }
          if [[ -n "${{ secrets.butler-api-key }}" ]]; 
            then output "true";
            else output "false";
          fi

      - name: Push
        if: steps.secret.outputs.secret == 'true'
        uses: bend-n/godot-actions/.github/actions/itch-push@main
        with:
          api-key: ${{ secrets.butler-api-key }}
          itch-path: ${{ inputs.itch-path }}