forked from abarichello/godot-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
154 lines (139 loc) · 4.2 KB
/
.gitlab-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
image: barichello/godot-ci:3.4
# NOTE: the `cd` command in each build stage is not necessary if your
# project.godot is at the repo root
# Cache imported assets between runs
cache:
key: import-assets
paths:
- .import/
stages:
- export
- deploy
variables:
EXPORT_NAME: test-project
linux:
stage: export
script:
- mkdir -v -p build/linux
- cd $EXPORT_NAME
- godot -v --export "Linux/X11" ../build/linux/$EXPORT_NAME.x86_64
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/linux
windows:
stage: export
script:
- mkdir -v -p build/windows
- cd $EXPORT_NAME
- godot -v --export "Windows Desktop" ../build/windows/$EXPORT_NAME.exe
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/windows
mac:
stage: export
script:
- mkdir -v -p build/mac
- cd $EXPORT_NAME
- godot -v --export "Mac OSX" ../build/mac/$EXPORT_NAME.zip
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/mac
web:
stage: export
script:
- mkdir -v -p build/web
- cd $EXPORT_NAME
- godot -v --export "HTML5" ../build/web/index.html
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/web
# Android Debug Job. It will use the generated debug.keystore.
android_debug:
stage: export
script:
- mkdir -v -p build/android
- cd $EXPORT_NAME
- godot -v --export-debug "Android Debug" ../build/android/$EXPORT_NAME-debug.apk
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/android
# Android Release Job. You will need to include keystore and password in the GitLab variable settings:
# 1. Take your generated keystore and convert it to Base64:
# Linux & macOS: `base64 release.keystore -w 0`
# Windows: `certutil -encodehex -f release.keystore encoded.txt 0x40000001`
# 2. Go to GitLab Project > Settings > CI/CD > Variables and copy the Base64-encoded keystore value in a new variable `SECRET_RELEASE_KEYSTORE_BASE64` as type variable.
# 3. Create a second variable SECRET_RELEASE_KEYSTORE_USER as type variable with the alias of your keystore as value.
# 4. Create a third variable SECRET_RELEASE_KEYSTORE_PASSWORD as type variable with the password of your keystore as value.
android:
stage: export
rules:
- if: $SECRET_RELEASE_KEYSTORE_BASE64
- if: $SECRET_RELEASE_KEYSTORE_USER
- if: $SECRET_RELEASE_KEYSTORE_PASSWORD
script:
- echo $SECRET_RELEASE_KEYSTORE_BASE64 | base64 --decode > /root/release.keystore
- mkdir -v -p build/android
- cd $EXPORT_NAME
- sed 's@keystore/release=".*"@keystore/release="'/root/release.keystore'"@g' -i export_presets.cfg
- sed 's@keystore/release_user=".*"@keystore/release_user="'$SECRET_RELEASE_KEYSTORE_USER'"@g' -i export_presets.cfg
- sed 's@keystore/release_password=".*"@keystore/release_password="'$SECRET_RELEASE_KEYSTORE_PASSWORD'"@g' -i export_presets.cfg
- godot -v --export "Android" ../build/android/$EXPORT_NAME.apk
artifacts:
name: $EXPORT_NAME-$CI_JOB_NAME
paths:
- build/android
# GitHub Pages Deploy
deploy-github-pages:
stage: deploy
dependencies:
- web
script:
# This ensures the `gh-pages` branch is available.
- git fetch
- git checkout gh-pages
- rm -f *.md
- mv build/web/** .
- git config user.email $GIT_EMAIL
- git config user.name $GIT_USERNAME
- git remote add github $REMOTE_URL
- git add -A
- 'git commit -m "ci: Deploy GitHub Page | $EXPORT_NAME:$CI_JOB_NAME" -m "Deploy from GitLab pipeline #$CI_PIPELINE_ID" || true'
- git push github gh-pages -f
# GitLab Pages Deploy
pages:
stage: deploy
dependencies:
- web
script:
# This ensures the `pages` branch is available.
- git fetch
- git checkout pages
- rm -f *.md
- mv build/web/** ./public
artifacts:
paths:
- public
# Itch.io Deploy
itchio:linux:
stage: deploy
script:
- butler push ./build/linux $ITCHIO_USERNAME/$ITCHIO_GAME:linux
dependencies:
- linux
itchio:windows:
stage: deploy
script:
- butler push ./build/windows $ITCHIO_USERNAME/$ITCHIO_GAME:windows
dependencies:
- windows
itchio:macosx:
stage: deploy
script:
- butler push ./build/mac $ITCHIO_USERNAME/$ITCHIO_GAME:mac
dependencies:
- mac