angular-react/.circleci/config.yml

121 строка
3.0 KiB
YAML

version: 2
jobs:
build:
ignore:
- gh-pages
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: 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:
- '3a:38:3d:25:c1:1e:d8:ec:69:a0:13:3c:c6:c9:24:a9'
- 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: build docs (@angular-react/core)
command: npm run build:demo: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
build_and_publish-docs:
jobs:
- build
- publish-docs:
requires:
- build
filters:
branches:
only: master