-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
61 lines (54 loc) · 2.06 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
variables:
SONAR_HOST_URL: https://sonarcloud.io
image: $CI_REGISTRY/autowp/runner-base-image
stages:
- build
- deploy
- publish
build:
stage: build
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
script:
- hadolint Dockerfile
- npm ci || npm cache clear --force && npm ci
- npx ng lint
- npx stylelint "src/**/*.scss"
- sonar-scanner -Dsonar.login=$SONAR_TOKEN
- ./node_modules/.bin/ng build --configuration production --no-progress --base-href=/
- npx semantic-release
rules:
- if: $CI_COMMIT_TAG !~ /^v\d.*/
deploy:
stage: deploy
script:
- npm ci || npm cache clear --force && npm ci
- "jq -n --arg release \"$CI_COMMIT_TAG\" '{release: $release}' > src/version.json"
- NG_BUILD_OPTIMIZE_CHUNKS=1 ./node_modules/.bin/ng build --configuration production --no-progress --base-href=/
- echo "$DOCKER_PASSWORD" | buildah login -u "$DOCKER_USERNAME" --password-stdin docker.io
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
- buildah pull "$CI_REGISTRY_IMAGE" || true
- buildah build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" .
- buildah push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- sentry-cli releases new "$CI_COMMIT_TAG" || true
- git config --global user.email "$GITLAB_USER_EMAIL"
- git config --global user.name "$GITLAB_USER_NAME"
- git clone -b master https://gitpush:${GITPUSH_TOKEN}@gitlab.pereslegin.ru/autowp/helm.git
- cd helm
- yq -i '.frontend.image.tag = strenv(CI_COMMIT_TAG)' values.yaml
- git add values.yaml
- "git commit -m \"feat: Update frontend to $CI_COMMIT_TAG\""
- git push origin master
- sentry-cli releases finalize "$CI_COMMIT_TAG" || true
- buildah pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- buildah tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" autowp/autowp-frontend:$CI_COMMIT_TAG
- buildah push autowp/autowp-frontend:$CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG =~ /^v\d.*/
environment:
name: production
url: https://www.wheelsage.org/