-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
48 lines (46 loc) · 1.22 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
default:
image: registry.gitlab.com/newcubator/newcubator/micro-bots/buildutil-node:20.18.0-alpine
cache:
key:
files:
- .nvmrc
- package-lock.json
paths:
- node_modules/
before_script:
- grep -q $(node -v | cut -c2-) .nvmrc
- >
[[ -d node_modules ]] || npm ci
test:
stage: test
script:
- npm run lint
- npm run test
coverage: '/^Statements\s*:\s*([^%]+)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
deploy:
stage: deploy
environment:
name: production
deployment_tier: production
id_tokens:
GITLAB_OIDC_TOKEN:
aud: https://gitlab.com
script:
- >
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s"
$(aws sts assume-role-with-web-identity
--role-arn arn:aws:iam::931595285256:role/GitlabCi
--role-session-name "GitLabRunner-${CI_PROJECT_ID}-${CI_PIPELINE_ID}"
--web-identity-token $GITLAB_OIDC_TOKEN
--duration-seconds 3600
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]'
--output text))
- aws sts get-caller-identity
- npm run deploy:prod
only:
- main