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

66 lines
1.2 KiB
YAML
Raw Permalink 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 21:40:21 +00:00
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
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
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
only:
- tags
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
only:
- tags