feat(circleci): add nightly build and manual releases

This commit is contained in:
Pooya Parsa 2018-12-30 00:50:41 +03:30
parent 49a7d0c7f8
commit ec99922429

View File

@ -5,7 +5,13 @@ defaults: &defaults
docker: docker:
- image: banian/node-headless-chrome - image: banian/node-headless-chrome
environment: environment:
- NODE_ENV: test NODE_ENV: test
release_branches: &release_branches
branches:
only:
- dev
- next
jobs: jobs:
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
@ -115,52 +121,50 @@ jobs:
- run: - run:
name: release name: release
command: | command: |
GIT_COMMIT_MSG=`git --no-pager log --pretty=full -n1 $CIRCLE_SHA1` echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
if echo "$GIT_COMMIT_MSG" | grep -o "\[release\]"; then echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc yarn lerna version --yes --no-git-tag-version --no-push
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc PACKAGE_SUFFIX=edge yarn build
yarn lerna version --yes --no-git-tag-version --no-push if [ "$CIRCLE_BRANCH" = "next" ]; then tag="--tag next"; fi
PACKAGE_SUFFIX=edge yarn build ./scripts/workspace-run npm publish $tag -q
if [ "$CIRCLE_BRANCH" = "next" ]; then tag="--tag next"; fi
./scripts/workspace-run npm publish $tag -q
fi
# Workflow definition # Workflow definition
workflows: workflows:
version: 2 version: 2
setup-and-test:
# Build and test after each commit
# Manually release on releas branches
commit:
jobs: jobs:
- setup - setup
- lint: { requires: [setup] }
- lint: - audit: { requires: [setup] }
requires: - build: { requires: [setup] }
- setup - test-unit: { requires: [build] }
- test-e2e: { requires: [build] }
- audit: - release-approval:
requires: type: approval
- setup requires: [build, lint, audit, test-unit, test-e2e]
filters:
- build: <<: *release_branches
requires:
- setup
- test-unit:
requires:
- build
- test-e2e:
requires:
- build
- release: - release:
requires: requires:
- build - release-approval
- lint
- audit
- test-unit
- test-e2e
filters: filters:
branches: <<: *release_branches
only:
- dev # Release nightly builds on release branches
- next nightly:
jobs:
- setup
- lint: { requires: [setup] }
- audit: { requires: [setup] }
- build: { requires: [setup] }
- test-unit: { requires: [build] }
- test-e2e: { requires: [build] }
- release: { requires: [build, lint, audit, test-unit, test-e2e] }
triggers:
- schedule:
cron: "0 0 * * *"
filters:
<<: *release_branches