-
Notifications
You must be signed in to change notification settings - Fork 38
/
github-deployments-feature.yml
47 lines (43 loc) · 1.35 KB
/
github-deployments-feature.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
#
# feature-branches deployments
# these jobs interact with the GitHub API to post the deployment URL and status to the pull-request
#
.get_github_id_stage: &get_github_id_stage
stage: "Prepare"
image:
name: ${CI_REGISTRY}/${IMAGE_INFRA_BASE_NAME}/git-deploy:1.0
before_script:
- envsubst < /scripts/get-deploy-id.sh > /scripts/get-github-deploy-id.sh
script:
- sh /scripts/get-github-deploy-id.sh
artifacts:
paths:
- github_deploy_id
# do it only on PR
Get Github Id (feature):
<<: *get_github_id_stage
environment:
name: ${DEV_ENVIRONMENT_NAME}
except:
- master
- /^v.*/
.send_url_to_github_stage: &send_url_to_github_stage
image:
name: ${CI_REGISTRY}/${IMAGE_INFRA_BASE_NAME}/git-deploy:1.0
script:
- export DEPLOY_ID=$(cat github_deploy_id)
- envsubst < /scripts/send-url.sh > /scripts/send-url-to-github.sh
- sh /scripts/send-url-to-github.sh
# do it only on PR
Send deployment url to Github (feature):
<<: *send_url_to_github_stage
stage: "Send Url to GitHub (feature)"
before_script:
- HASH_BRANCH_NAME=$(printf "${CI_COMMIT_REF_NAME}" | sha1sum | cut -c1-5)
- export INGRESS_ENVIRONMENT_PREFIX=${HASH_BRANCH_NAME}
- export URL=https://${INGRESS_ENVIRONMENT_PREFIX}.${CI_PROJECT_NAME}.${DOMAIN_NAME}/
environment:
name: ${DEV_ENVIRONMENT_NAME}
except:
- master
- /^v.*/