add ci script

This commit is contained in:
2021-06-18 21:02:19 +02:00
parent 35af079fb0
commit 16029f00ec

58
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,58 @@
stages:
- build
- check
- dockerize
variables:
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
build:
image: node:14-buster
stage: build
tags:
- hottis
- linux
- docker
rules:
- if: $CI_COMMIT_TAG
artifacts:
paths:
- dist.tgz
expire_in: 1 day
script:
- cd hv2-ui
- npm install
- ./node_modules/.bin/ng build --prod
- tar -czf ../dist.tgz dist
check:
image: registry.hottis.de/dockerized/base-build-env:latest
stage: check
tags:
- hottis
- linux
- docker
rules:
- if: $CI_COMMIT_TAG
script:
- checksemver.py -v
--versionToValidate "$CI_COMMIT_TAG"
--validateMessage
--messageToValidate "$CI_COMMIT_MESSAGE"
dockerize:
image: registry.hottis.de/dockerized/docker-bash:latest
stage: dockerize
tags:
- hottis
- linux
- docker
rules:
- if: $CI_COMMIT_TAG
script:
- tar -xzf dist.tgz
- docker build --tag $IMAGE_NAME:latest --tag $IMAGE_NAME:$CI_COMMIT_TAG .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $IMAGE_NAME:latest
- docker push $IMAGE_NAME:$CI_COMMIT_TAG