Yield generated for 299d9cce-b9b3-47cc-8563-712abc5e34d9
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

109 lines
3.2 KiB

version: 2.1
workflows:
build_and_test:
jobs:
- build
- lint:
requires:
- build
- test:
requires:
- build
- build_docker:
requires:
- lint
- test
filters:
branches:
only:
- main
- publish_image:
context:
- DOCKER
requires:
- build_docker
filters:
branches:
only:
- main
- build_docs_artifact:
requires:
- lint
- test
filters:
branches:
only:
- main
jobs:
build:
docker:
- image: cimg/node:dubnium
steps:
- checkout
- restore_cache:
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn global add node-gyp && yarn install
- save_cache:
key: yarn-packages-v2{{ checksum "yarn.lock" }}
paths:
- ./node_modules
lint:
docker:
- image: cimg/node:dubnium
steps:
- checkout
- restore_cache:
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run : yarn lint && yarn format:check
test:
docker:
- image: cimg/node:dubnium
steps:
- checkout
- restore_cache:
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run : yarn test:ci
build_docker:
environment:
IMAGE_NAME: 698148/my-awesome-project
docker:
- image: circleci/buildpack-deps:stretch
steps:
- checkout
- setup_remote_docker
- run: docker image build --tag $IMAGE_NAME:app .
- run: docker save -o image.tar $IMAGE_NAME
- persist_to_workspace:
root: .
paths:
- ./image.tar
publish_image:
environment:
IMAGE_NAME: 698148/my-awesome-project
docker:
- image: circleci/buildpack-deps:stretch
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run: docker load -i /tmp/workspace/image.tar
- run:
name: Login and Publish to Docker Hub
command: |
echo "$DOCKERHUB_PASS" | docker login --username 698148 --password-stdin
docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM
docker tag $IMAGE_NAME:app $IMAGE_NAME:latest
docker push $IMAGE_NAME:$CIRCLE_BUILD_NUM
docker push $IMAGE_NAME:latest
build_docs_artifact:
docker:
- image: cimg/node:dubnium
steps:
- checkout
- restore_cache:
key: yarn-packages-v2{{ checksum "yarn.lock" }}
- run: yarn doc:build
- run: ls
- store_artifacts:
path: doc-server
destination: doc-server