This repository has been archived on 2024-08-06. You can view files and clone it, but cannot push or open issues or pull requests.
readyornot/.gitlab-ci.yml

71 lines
1.4 KiB
YAML
Raw Normal View History

2022-12-03 21:25:14 +00:00
# avoids unecessary repulling of node modules
cache:
paths:
2022-12-03 21:35:14 +00:00
- node_modules/
2022-12-03 21:25:14 +00:00
stages:
- lint
#- test
- build
- deploy
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
2022-12-03 22:02:39 +00:00
IMAGE_LATEST: $CI_REGISTRY_IMAGE:develop
2022-12-03 21:25:14 +00:00
.node:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:latest
.docker:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:20
2022-12-03 22:02:39 +00:00
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG
variables:
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
2022-12-03 21:25:14 +00:00
linter:
image: !reference [.node, image]
stage: lint
before_script:
- yarn install
script:
- yarn lint
build:
image: !reference [.docker, image]
stage: build
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
2022-12-03 21:35:14 +00:00
- docker build -t $IMAGE_TAG .
2022-12-03 21:25:14 +00:00
after_script:
- docker save $IMAGE_TAG > docker.tar
artifacts:
expire_in: 30 mins
paths:
- docker.tar
2022-12-03 22:02:39 +00:00
rules:
- !reference [.docker, rules]
2022-12-03 21:25:14 +00:00
push:
image: !reference [.docker, image]
stage: deploy
needs:
- job: build
artifacts: true
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker load -i docker.tar
script:
- docker tag $IMAGE_TAG $IMAGE_LATEST
- docker push $IMAGE_TAG
- docker push $IMAGE_LATEST
2022-12-03 22:02:39 +00:00
rules:
- !reference [.docker, rules]