angular-react/.circleci/config.yml

132 строки
3.3 KiB
YAML

version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10-browsers
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install dependencies
command: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: test libs/core (@angular-react/core)
command: npm run test:ci -- core
- run:
name: build libs/core (@angular-react/core)
command: npm run build:libs:core
- run:
name: build libs/fabric (@angular-react/fabric)
command: npm run build:libs:fabric
- run:
name: build libs/semantic-ui (@angular-react/semantic-ui)
command: npm run build:libs:semantic-ui
- run:
name: build apps/demo
command: npm run build:demo
publish-docs:
docker:
# specify the version you desire here
- image: circleci/node:10-browsers
working_directory: ~/repo
environment:
- SOURCE_BRANCH: master
- TARGET_BRANCH: gh-pages
steps:
- add_ssh_keys:
fingerprints:
- '6a:f7:26:f6:f6:43:4b:96:7c:f5:1b:0a:cc:d2:bc:11'
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install dependencies
command: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: test docs
command: npm run test:ci -- docs
- run:
name: build docs
command: npm run build:github
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
git config --global user.name "CircleCI"
git config --global user.email "circleci@users.noreply.github.com"
git clone $CIRCLE_REPOSITORY_URL out
cd out
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
git rm -rf .
cd ..
npm run build:demo:github
cp -a docs/. out/.
mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/.
cd out
git add -A
git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty
git push origin $TARGET_BRANCH
fi
workflows:
version: 2
build:
jobs:
- build:
filters:
branches:
ignore: gh-pages
build_and_publish-docs:
jobs:
- build:
filters:
branches:
only: master
- publish-docs:
requires:
- build
filters:
branches:
only: master