-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
42 lines (39 loc) · 1.34 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
42 lines (39 loc) · 1.34 KB
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
stages:
- build
- deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/website:$CI_COMMIT_SHORT_SHA
IMAGE_LATEST: $CI_REGISTRY_IMAGE/website:latest
build-website:
stage: build
image: docker:24
services:
- docker:24-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build --no-cache -t $IMAGE_TAG -t $IMAGE_LATEST website/
- docker push $IMAGE_TAG
- docker push $IMAGE_LATEST
rules:
- if: $CI_COMMIT_BRANCH == "main"
deploy-railway:
stage: deploy
image: curlimages/curl:latest
script:
- |
curl -s -X POST https://backboard.railway.app/graphql/v2 \
-H "Authorization: Bearer $RAILWAY_API_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"query\": \"mutation { serviceInstanceUpdate(serviceId: \\\"$RAILWAY_SERVICE_ID\\\", input: { source: { image: \\\"${IMAGE_TAG}\\\" } }) }\"}"
- |
curl -s -X POST https://backboard.railway.app/graphql/v2 \
-H "Authorization: Bearer $RAILWAY_API_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"query\": \"mutation { serviceInstanceRedeploy(serviceId: \\\"$RAILWAY_SERVICE_ID\\\", environmentId: \\\"$RAILWAY_ENV_ID\\\") }\"}"
rules:
- if: $CI_COMMIT_BRANCH == "main"
needs:
- build-website