This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
105 lines (91 loc) · 2.58 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
variables:
# Shared variables for ghaction-github-pages
INPUT_AUTHOR: "Gitlab CI"
INPUT_BUILD_DIR: build
GITHUB_REPOSITORY: spaship/spaship-examples # Defines the git repository name
# TEST website.yaml files
test_website_configs:
stage: test
only:
- main
- merge_requests
tags:
- docker
image:
# docs: https://github.com/spaship/operator/tree/main/config-validator
name: quay.io/spaship/config-validator-jvm
entrypoint: [ "" ]
script:
- /deployments/run-java.sh $(pwd)/websites/01-simple/website.yaml $(pwd)/websites/02-advanced/website.yaml $(pwd)/websites/03-spa-restapi-mongo/website.yaml
# PUBLISH to branches
.prepare_cacert: &prepare_cacert
# If IMPORT_CACERT_URL contains URL to CA certificate performs the CA import
- |
if [[ -z $IMPORT_CACERT_URL ]]; then
echo "Nothing to import"
else
echo "Importing ${IMPORT_CACERT_URL}"
curl -k $IMPORT_CACERT_URL --create-dirs -o /usr/local/share/ca-certificates/gitlab-imported-ca.crt
update-ca-certificates
fi
.publish: &publish
- mkdir build
- cp -r websites build
# Same way as github actions based on https://github.com/crazy-max/ghaction-github-pages
- curl https://raw.githubusercontent.com/crazy-max/ghaction-github-pages/dev/dist/index.js > ghaction-github-pages.js
- node ghaction-github-pages.js
publish_prod:
stage: deploy
only:
refs:
- main
tags:
- docker
image: node:12
variables:
# Variables needs to be INPUT_variable_name_uppercase
# see https://github.com/actions/toolkit/blob/c9819f79d2a27c1f26ef7ea85ff44346e7d60741/packages/core/src/core.ts#L69
INPUT_TARGET_BRANCH: prod
INPUT_COMMIT_MESSAGE: Publish to prod
INPUT_KEEP_HISTORY: "true"
# Defined in Settings -> CI/CD
# INPUT_DOMAIN: # gitlab domain
# GH_PAT: # Format: oauth2:YOURTOKEN
before_script:
- *prepare_cacert
script:
- *publish
when: manual
except:
- merge_requests
publish_prod_no_history:
stage: deploy
only:
refs:
- main
tags:
- docker
image: node:12
variables:
INPUT_TARGET_BRANCH: prod_no_history
INPUT_COMMIT_MESSAGE: Publish to prod
INPUT_KEEP_HISTORY: "false"
before_script:
- *prepare_cacert
script:
- *publish
when: manual
except:
- merge_requests
# Review Apps
deploy_review:
stage: deploy
tags:
- docker
script:
- echo "Deploy a review app"
environment:
name: review/simple-pr-$CI_MERGE_REQUEST_IID-dev
url: https://simple-pr-$CI_MERGE_REQUEST_IID-dev-spaship-examples.$OPERATOR_DOMAIN
only:
- merge_requests