Skip to content

Instantly share code, notes, and snippets.

@javatodev
Created August 17, 2021 20:37
Show Gist options
  • Save javatodev/59c818fff2ab97d041ca7a28e4d957ad to your computer and use it in GitHub Desktop.
Save javatodev/59c818fff2ab97d041ca7a28e4d957ad to your computer and use it in GitHub Desktop.
services:
- docker:dind
stages:
- dependencies
- test
- build
- publish
install_dependencies:
image: node:12-alpine
stage: dependencies
script:
- npm install
only:
- master
cache:
key:
files:
- package-lock.json
paths:
- node_modules
lint:
image: node:12-alpine
stage: test
script:
- npm link @angular/cli@11.2.6
- ng lint
cache:
key:
files:
- package-lock.json
paths:
- node_modules
policy: pull
test:
image: markhobson/node-chrome:latest
stage: test
script:
- npm link @angular/cli@11.2.6
- npm test -- --browsers=ChromeHeadless --watch=false
cache:
key:
files:
- package-lock.json
paths:
- node_modules
policy: pull
build_image:
image: node:12-alpine
stage: build
script:
- npm link @angular/cli@11.2.6
- npm run build
artifacts:
paths:
- $CI_PROJECT_DIR/dist
cache:
key:
files:
- package-lock.json
paths:
- node_modules
policy: pull
push-docker-registry:
image: docker:latest
stage: publish
only:
- master
script:
- docker build -t registry.gitlab.com/chikaslocalhost/angular-ci-cd .
- docker login -u chikaslocalhost -p $CI_BUILD_TOKEN registry.gitlab.com
- docker push registry.gitlab.com/chikaslocalhost/angular-ci-cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment