Skip to content

Commit 3007b68

Browse files
committed
ci: Deploy devopsaci-landing (to production) and devopsaci.cz to test
1 parent 46f9400 commit 3007b68

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

generate-gitlab-ci-statica.py

+52-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@
2929
{"name": "digitalocean.cz"},
3030
{"name": "devopsnews.cz"},
3131
{"name": "hashicorp.cz"},
32-
{"name": "devopsaci.cz"},
32+
{"name": "devopsaci-landing", "domain": "devopsaci.cz"},
3333
{"name": "sikahosting.com"},
3434
]
3535

36+
SITES_SITES20_DEV = [
37+
{"name": "devopsaci.cz"},
38+
]
39+
3640
_DEFAULT_DEPENDENCIES = [
3741
"packages/data/**/*",
3842
"packages/common/**/*",
@@ -178,6 +182,7 @@ def gen_deps(deps, name):
178182
for site in SITES_SITES20:
179183
name = site["name"]
180184
deps = _SITES20_DEPENDENCIES
185+
domain = site.get("domain", name)
181186
out.update(
182187
{
183188
"deploy sites20 %s"
@@ -208,7 +213,7 @@ def gen_deps(deps, name):
208213
% name: {
209214
"stage": "deploy validate",
210215
"script": [
211-
"COMMIT=$(curl -fsSL https://%s/api/version.json | jq -r .git_commit)" % name,
216+
"COMMIT=$(curl -fsSL https://%s/api/version.json | jq -r .git_commit)" % domain,
212217
"[ $COMMIT == $CI_COMMIT_SHA ]",
213218
],
214219
"only": {
@@ -225,5 +230,50 @@ def gen_deps(deps, name):
225230
}
226231
)
227232

233+
for site in SITES_SITES20_DEV:
234+
name = site["name"]
235+
deps = _SITES20_DEPENDENCIES
236+
statica_domain = (
237+
"test-" + name.replace(".", "-") + "-$CI_COMMIT_REF_SLUG.$STATICA_BASE_DOMAIN"
238+
)
239+
out.update(
240+
{
241+
"deploy dev sites20 %s"
242+
% name: {
243+
"stage": "deploy",
244+
"script": [
245+
"mkdir -p sites20/sites/%s/public/api" % name,
246+
"slu static-api version --set-git-clean --set-git-ref $CI_COMMIT_REF_NAME -e CI_PIPELINE_ID=$CI_PIPELINE_ID -e \"GITLAB_USER_LOGIN=$GITLAB_USER_LOGIN\" -e \"CI_COMMIT_TITLE=$CI_COMMIT_TITLE\" > sites20/sites/%s/public/api/version.json" % name,
247+
"cd sites20",
248+
"rm -rf ./sites/%s/out" % name,
249+
"yarn --cache-folder .yarn-cache",
250+
"statica %s ./sites/%s/out" % (statica_domain, name)
251+
],
252+
"only": {
253+
"changes": gen_deps(deps, name),
254+
},
255+
"needs": [],
256+
}
257+
}
258+
)
259+
out.update(
260+
{
261+
"validate dev %s"
262+
% name: {
263+
"stage": "deploy validate",
264+
"script": [
265+
"COMMIT=$(curl -fsSL https://%s/api/version.json | jq -r .git_commit)" % statica_domain,
266+
"[ $COMMIT == $CI_COMMIT_SHA ]",
267+
],
268+
"only": {
269+
"changes": gen_deps(deps, name),
270+
},
271+
"needs": [
272+
"deploy dev sites20 %s" % name,
273+
],
274+
}
275+
}
276+
)
277+
228278
with open(".gitlab-ci-statica.generated.yml", "w") as f:
229279
f.write(json.dumps(out))

0 commit comments

Comments
 (0)