generated from hatmix/godot-4-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (111 loc) · 4.2 KB
/
godot-ci.yml
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
name: "godot-ci"
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- '!ATTRIBUTION.md'
- '.gitignore'
- '.gitattributes'
workflow_dispatch:
inputs:
exporttype:
description: 'Export type (debug/release)'
default: debug
required: false
type: choice
options:
- debug
- release
concurrency:
group: there-can-be-only-one
cancel-in-progress: true
env:
GODOT_VERSION: 4.3
PROJECT_NAME: ${{ github.event.repository.name }}
jobs:
test-and-export:
name: Test and Export
runs-on: ubuntu-20.04
container:
image: barichello/godot-ci:4.3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Export Templates
run: |
mkdir -v -p ~/.local/share/godot/export_templates
# 4.2
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
# 4.1
#ls /root/.local/share/godot/templates/
#mv /root/.local/share/godot/templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Install Plugins
run: |
godot --headless --path . -s plug.gd install || true
- name: Fix Imports
run: |
godot --headless --path . --export-pack FixImports tmp.zip 2>&1 >/dev/null
- name: Test
id: test
run: |
godot --headless --path . -s addons/gut/gut_cmdln.gd -gexit
- name: Remove Dev-only Plugins
run: |
godot --headless --path . -s plug.gd install production || true
- name: Export
id: export
env:
ITCHIO_USERNAME: ${{ secrets.ITCHIO_USERNAME }}
ITCHIO_GAME: ${{ secrets.ITCHIO_GAME }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
EXPORT_TYPE_INPUT: ${{ github.event.inputs.exporttype }}
if: steps.test.outcome == 'success' && env.ITCHIO_USERNAME && env.ITCHIO_GAME && env.BUTLER_API_KEY
run: |
EXPORT_TYPE="${EXPORT_TYPE_INPUT:=debug}"
echo export $EXPORT_TYPE
godot --headless --path . --export-${EXPORT_TYPE} "Web" exports/web/index.html
godot --headless --path . --export-${EXPORT_TYPE} "Linux" exports/linux/${ITCHIO_GAME}.x86_64
godot --headless --path . --export-${EXPORT_TYPE} "macOS" exports/macos/${ITCHIO_GAME}.zip
godot --headless --path . --export-${EXPORT_TYPE} "Windows" exports/windows/${ITCHIO_GAME}.exe
#find exports -name '*'
- name: Cache butler files
id: cache-butler
if: steps.export.outcome == 'success'
uses: actions/cache@v4
with:
path: butler
key: ${{ runner.os }}-butler
- name: Download Butler
env:
ITCHIO_USERNAME: ${{ secrets.ITCHIO_USERNAME }}
ITCHIO_GAME: ${{ secrets.ITCHIO_GAME }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: steps.cache-butler.outputs.cache-hit != 'true' && steps.export.outcome == 'success'
run: |
wget -O butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
- name: Butler Push
env:
ITCHIO_USERNAME: ${{ secrets.ITCHIO_USERNAME }}
ITCHIO_GAME: ${{ secrets.ITCHIO_GAME }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
if: steps.export.outcome == 'success' && env.ITCHIO_USERNAME && env.ITCHIO_GAME && env.BUTLER_API_KEY
run: |
if [ -f exports/web/index.html ]; then
./butler push exports/web/ ${ITCHIO_USERNAME}/${ITCHIO_GAME}:HTML5
fi
if [ -f exports/linux/${ITCHIO_GAME}.x86_64 ]; then
./butler push exports/windows/ ${ITCHIO_USERNAME}/${ITCHIO_GAME}:linux
fi
if [ -f exports/macos/${ITCHIO_GAME}.zip ]; then
./butler push exports/windows/ ${ITCHIO_USERNAME}/${ITCHIO_GAME}:macos
fi
if [ -f exports/windows/${ITCHIO_GAME}.exe ]; then
./butler push exports/windows/ ${ITCHIO_USERNAME}/${ITCHIO_GAME}:windows
fi