-
Notifications
You must be signed in to change notification settings - Fork 0
236 lines (198 loc) · 7.06 KB
/
game_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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: "Godot 4.3 CI/CD"
env:
GODOT_VERSION: 4.2.1
on:
push:
branches:
- main
tags:
- v*
jobs:
commit_log:
runs-on: ubuntu-latest
outputs:
commit_log: ${{ steps.collect_commits.outputs.commit_log }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for the repo
- name: Get commit log
id: collect_commits
run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
echo "No previous tag found, showing all commits."
COMMIT_LOG=$(git log --pretty=format:"%h - %an, %ar : %s")
else
echo "Showing commits since $LAST_TAG."
COMMIT_LOG=$(git log --pretty=format:"%h - %an, %ar : %s" $LAST_TAG..HEAD)
fi
echo "commit_log=$COMMIT_LOG" >> $GITHUB_ENV
echo "::set-output name=commit_log::$COMMIT_LOG"
web:
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Move export templates into position
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Create staging directory
run: mkdir -v -p build/web
- name: Build for Web
run: godot -v --export-release --headless "Web"
- name: Add coi-service-worker
run: |
git clone https://github.com/gzuidhof/coi-serviceworker.git
mv coi-serviceworker/coi-serviceworker.js build/web/coi-serviceworker.js
sed -i '3 i <script src="coi-serviceworker.js"></script>' build/web/index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/web
force_orphan: true
user_name: "github-ci[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
commit_message: "UPDATE GITHUB PAGES"
- name: Zip Web artifacts
run: zip -r game_web.zip build/web
- name: Upload Web artifacts
uses: actions/upload-artifact@v3
with:
name: game_web
path: game_web.zip
linux:
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Move export templates into position
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Create staging directory
run: mkdir -v -p build/linux
- name: Build for Linux
run: godot -v --export-release --headless "Linux/X11" --path . --output "build/linux/game.x86_64"
- name: Zip Linux artifacts
run: zip -r game_linux.zip build/linux
- name: Upload Linux artifacts
uses: actions/upload-artifact@v3
with:
name: game_linux
path: game_linux.zip
windows:
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Move export templates into position
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Create staging directory
run: mkdir -v -p build/windows
- name: Build for Windows
run: godot -v --export-release --headless "Windows Desktop" --path . --output "build/windows/game.x86_64"
- name: Zip Windows artifacts
run: zip -r game_windows.zip build/windows
- name: Upload Windows artifacts
uses: actions/upload-artifact@v3
with:
name: game_windows
path: game_windows.zip
release:
needs: [web, linux, windows, commit_log]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Execute GitVersion
uses: gittools/actions/gitversion/execute@v0.9.15
with:
useConfigFile: true
configFilePath: GitVersion.yml
- name: Get branch name
id: get_branch
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Download Web artifacts
uses: actions/download-artifact@v3
with:
name: game_web
- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: game_linux
- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: game_windows
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{env.GitVersion_MajorMinorPatch}}
release_name: "Version ${{env.GitVersion_MajorMinorPatch}}"
body: |
## Release Notes for Version ${{env.GitVersion_MajorMinorPatch}}
### Commits:
${{ needs.commit_log.outputs.commit_log }}
### Additional Information:
As always thanks for playing!
draft: false
prerelease: true
- name: Upload Web Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_web.zip
asset_name: Throwdwarf_Web.zip
asset_content_type: application/zip
- name: Upload Linux Release Asset
id: upload-linux-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_linux.zip
asset_name: Throwdwarf_Linux.zip
asset_content_type: application/zip
- name: Upload Windows Release Asset
id: upload-windows-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: game_windows.zip
asset_name: Throwdwarf_Windows.zip
asset_content_type: application/zip