scratch-paint/.circleci/config.yml

73 lines
1.9 KiB
YAML
Raw Normal View History

version: 2.1
aliases:
- &defaults
docker:
2022-03-29 13:35:42 -04:00
- image: cimg/node:12.22.11-browsers
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
working_directory: ~/repo
environment:
NODE_ENV: production
- &setup
name: "setup"
command: |
npm --production=false ci
mkdir ./test/results
- &lint
name: "run lint tests"
command: npm run lint -- --format junit -o ./test/results/lint-results.xml
- &unit
name: "run unit tests"
2022-03-29 17:13:04 -04:00
command: JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run unit -- --reporters=jest-junit
- &build
name: "run npm build"
command: |
NODE_ENV=production npm run build
2022-04-11 16:53:11 -04:00
- &tag-setup
name: "setup tags"
command: |
RELEASE_TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
VPKG=$($(npm bin)/json -f package.json version)
export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}
echo $RELEASE_VERSION
export NPM_TAG=latest
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard
export NPM_TAG=hotfix
fi
- &deploy-gh-pages
name: "deploy to gh pages"
command: |
git config --global user.email $(git log --pretty=format:"%ae" -n1)
git config --global user.name $(git log --pretty=format:"%an" -n1)
npm run deploy -- -e $CIRCLE_BRANCH
jobs:
build-test:
<<: *defaults
steps:
- checkout
- run:
<<: *setup
- run:
<<: *lint
- run:
<<: *unit
- run:
<<: *build
- store_test_results:
path: test/results
workflows:
build-test-no-deploy:
jobs:
- build-test:
context:
- dockerhub-credentials
filters:
branches:
ignore:
- master
- develop
- /^hotfix\/.*/