2022-03-17 10:20:40 -04:00
|
|
|
version: 2.1
|
|
|
|
aliases:
|
|
|
|
- &defaults
|
|
|
|
docker:
|
2022-03-29 13:35:42 -04:00
|
|
|
- image: cimg/node:12.22.11-browsers
|
2022-03-29 13:36:11 -04:00
|
|
|
auth:
|
|
|
|
username: $DOCKERHUB_USERNAME
|
|
|
|
password: $DOCKERHUB_PASSWORD
|
2022-03-17 10:20:40 -04:00
|
|
|
working_directory: ~/repo
|
|
|
|
environment:
|
|
|
|
NODE_ENV: production
|
|
|
|
- &setup
|
|
|
|
name: "setup"
|
|
|
|
command: |
|
|
|
|
npm --production=false ci
|
|
|
|
mkdir ./test/results
|
|
|
|
- &lint
|
|
|
|
name: "run lint tests"
|
2022-03-29 17:13:41 -04:00
|
|
|
command: npm run lint -- --format junit -o ./test/results/lint-results.xml
|
2022-03-17 10:20:40 -04:00
|
|
|
- &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
|
2022-03-17 10:20:40 -04:00
|
|
|
- &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)
|
2022-04-20 15:59:10 -04:00
|
|
|
echo export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP} >> $BASH_ENV
|
2022-04-20 10:42:22 -04:00
|
|
|
echo export NPM_TAG=latest >> $BASH_ENV
|
2022-04-11 16:53:11 -04:00
|
|
|
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard
|
2022-04-20 10:42:22 -04:00
|
|
|
echo export NPM_TAG=hotfix >> $BASH_ENV
|
2022-04-11 16:53:11 -04:00
|
|
|
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
|
2022-04-20 10:42:22 -04:00
|
|
|
- &deploy-npm
|
|
|
|
name: "deploy to npm"
|
|
|
|
command: |
|
2022-04-20 15:59:10 -04:00
|
|
|
echo "npm tag: $NPM_TAG"
|
|
|
|
echo "release version: $RELEASE_VERSION"
|
|
|
|
npm version --no-git-tag-version $RELEASE_VERSION
|
2022-04-20 10:42:22 -04:00
|
|
|
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
|
|
npm publish --tag $NPM_TAG
|
2022-04-20 15:59:10 -04:00
|
|
|
- &tag-commit
|
|
|
|
name: "tag commit in github"
|
|
|
|
command: |
|
|
|
|
echo $RELEASE_VERSION
|
|
|
|
git tag $RELEASE_VERSION
|
|
|
|
git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION
|
2022-03-17 10:20:40 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-test:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
<<: *setup
|
|
|
|
- run:
|
|
|
|
<<: *lint
|
|
|
|
- run:
|
|
|
|
<<: *unit
|
|
|
|
- run:
|
|
|
|
<<: *build
|
2022-03-29 17:20:42 -04:00
|
|
|
- store_test_results:
|
|
|
|
path: test/results
|
2022-04-12 13:49:05 -04:00
|
|
|
build-test-deploy:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
<<: *setup
|
|
|
|
- run:
|
|
|
|
<<: *lint
|
|
|
|
- run:
|
|
|
|
<<: *unit
|
|
|
|
- run:
|
|
|
|
<<: *build
|
|
|
|
- store_test_results:
|
|
|
|
path: test/results
|
|
|
|
- run:
|
|
|
|
<<: *tag-setup
|
|
|
|
- run:
|
|
|
|
<<: *deploy-gh-pages
|
2022-04-20 10:42:22 -04:00
|
|
|
- run:
|
|
|
|
<<: *deploy-npm
|
2022-04-20 15:59:10 -04:00
|
|
|
- run:
|
|
|
|
<<: *tag-commit
|
2022-04-22 10:23:30 -04:00
|
|
|
push-translations:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
<<: *setup
|
|
|
|
- run:
|
|
|
|
name: "run i18n script"
|
|
|
|
command: |
|
|
|
|
npm run i18n:src
|
|
|
|
npm run i18n:push
|
2022-03-17 10:20:40 -04:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
build-test-no-deploy:
|
|
|
|
jobs:
|
|
|
|
- build-test:
|
2022-03-29 13:36:11 -04:00
|
|
|
context:
|
|
|
|
- dockerhub-credentials
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
- /^hotfix\/.*/
|
2022-04-19 15:46:19 -04:00
|
|
|
- gh-pages
|
2022-04-12 13:49:05 -04:00
|
|
|
build-test-deploy:
|
|
|
|
jobs:
|
|
|
|
- build-test-deploy:
|
|
|
|
context:
|
|
|
|
- dockerhub-credentials
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
- /^hotfix\/.*/
|
2022-04-22 10:23:30 -04:00
|
|
|
push-translations:
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: 0 0 * * * # daily at 12 UTC, 8 ET
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
jobs:
|
|
|
|
- push-translations:
|
|
|
|
context:
|
|
|
|
- dockerhub-credentials
|