-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
144 lines (127 loc) · 3.55 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
cache:
paths:
- node_modules/
before_script:
- CI=true npm install
stages:
- build
- build-docker
- deploy
- release
.build:
image: node:20
stage: build
script:
- CI=true npm run build
artifacts:
paths:
- .next/standalone/
- public/
- .next/static/
build:dev:
extends: .build
environment:
name: development
rules:
- if: '$CI_COMMIT_BRANCH == "development" || $CI_COMMIT_TAG =~ /v[0-9]+\.[0-9]+\.[0-9]+\-rc.[0-9]+$/'
when: always
- when: never
build:prod:
extends: .build
environment:
name: production
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: always
- when: never
build-docker:
before_script:
- echo "pass"
- echo $CI_COMMIT_TAG
stage: build-docker
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
rules:
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development" || $CI_COMMIT_TAG
when: always
- if: $CI_MERGE_REQUEST_ID
when: never
- when: manual
release:
image: node:20 # Requires GIT
stage: release
allow_failure: true
rules:
# allow creating releases from master branch and mastertenance branches named like this:
# `MAJOR.MINOR.PATCH`, e.g. `1.16.2`
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH =~ /^[0-9]+(\.([0-9]+|x))?\.x$/'
when: on_success
- if: '$CI_COMMIT_BRANCH == "development"'
when: on_success
- when: never
script:
- npm install @semantic-release/[email protected] @semantic-release/exec @saithodev/semantic-release-backmerge
- npx semantic-release
.deploy:
image:
name: pulumi/pulumi:3.116.0
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stage: deploy
variables:
imageTag: $CI_COMMIT_TAG
registryImage: $CI_REGISTRY_IMAGE
script:
- cd deploy
- npm ci
- pulumi stack select bjoern_urban_5/cardmaster/${STAGE}
- pulumi update --skip-preview
# Create an artifact archive with just the pulumi log file,
# which is created using console-redirection in run-pulumi.sh.
artifacts:
paths:
- pulumi-log.txt
# This is just a sample of how artifacts can be expired (removed) automatically in GitLab.
# You may choose to not set this at all based on your organization's or team's preference.
expire_in: 1 week
# This job should only be created if the pipeline is created for the master branch.
deploy:dev:
extends: .deploy
environment:
name: development
variables:
STAGE: dev
rules:
- if: $CI_COMMIT_TAG =~ /v[0-9]+\.[0-9]+\.[0-9]+\-rc.[0-9]+$/
when: always
- if: $CI_MERGE_REQUEST_ID
when: never
deploy:prod:
extends: .deploy
environment:
name: production
variables:
STAGE: prod
rules:
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/
when: always
pulumi-preview:
image:
name: pulumi/pulumi:3.116.0
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stage: deploy
script:
- cd deploy
- npm ci
- pulumi stack select bjoern_urban_5/cardmaster/dev
- pulumi preview
rules:
- if: $CI_COMMIT_TAG == null
when: always