forked from startersclan/docker-sourceservers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
75 lines (72 loc) · 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
stages:
- build
- notify
build-image:
stage: build
image: docker:20.10.23-git
# See: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker
# For stateless builds, a sidecar dockerd service is needed
# For stateful builds (i.e. DOCKER_HOST=unix:///var/run/docker.sock mounted from the host), a sidecar dockerd service is not needed
services:
- docker:20.10.23-dind
variables:
DOCKER_DRIVER: overlay2
# DOCKER_HOST: unix:///var/run/docker.sock # For stateful builds, uncomment this, or set it in CI/CD variables
rules:
# Run on steam-* branches when .trigger is added or modified
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH =~ /^steam-\w+-\w+$/
changes:
- .trigger
timeout: 120m
script:
- |
set +e
./build.sh
if [ $? = 0 ]; then
echo BUILD_STATUS=success >> .build.state
else
echo BUILD_STATUS=failed >> .build.state
exit 1
fi
artifacts:
name: .build.state-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA
paths:
- .build.state
when: always
expire_in: never
notify:
stage: notify
image: alpine:3.15
rules:
# Run on steam-* branches when .trigger is added or modified
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH =~ /^steam-\w+-\w+$/
changes:
- .trigger
when: always
timeout: 5m
script:
- apk add --no-cache curl
- ./notify.sh
state:
stage: build
image: alpine:3.15
rules:
# Never run when .trigger is added or modified
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH =~ /^steam-\w+-\w+$/
changes:
- .trigger
when: never
# Run on steam-* branches when .state is added or modified
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH =~ /^steam-\w+-\w+$/
changes:
- .state
timeout: 5m
script:
- |
set -eu
. .state
if [ "$BUILD_STATUS" = 'success' ]; then
exit 0
else
exit 1
fi