Skip to content

Commit

Permalink
Merge pull request #4 from downplay/continuous-deployment
Browse files Browse the repository at this point in the history
Continuous deployment, tagged commits get published to npm (?)
  • Loading branch information
chucksellick authored Apr 8, 2018
2 parents 07edbe4 + 1630613 commit 3037df3
Show file tree
Hide file tree
Showing 13 changed files with 10,139 additions and 23,024 deletions.
95 changes: 76 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
docker:
# specify the version you desire here
- image: cypress/base:8

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
Expand All @@ -22,54 +22,53 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
- v2a-dependencies-{{ checksum "package.json" }}
- v3a-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v2a-dependencies-
- v3a-dependencies-
- restore_cache:
keys:
- v2b-dependencies-{{ checksum "demo/package.json" }}
- v3b-dependencies-{{ checksum "demo/package.json" }}
# fallback to using the latest cache if no exact match is found
- v2b-dependencies-
- v3b-dependencies-
- restore_cache:
keys:
- v2c-dependencies-{{ checksum "packages/jarl-react/package.json" }}
- v3c-dependencies-{{ checksum "packages/jarl-react/package.json" }}
# fallback to using the latest cache if no exact match is found
- v2c-dependencies-
- v3c-dependencies-
- restore_cache:
keys:
- v2d-dependencies-{{ checksum "packages/jarl-react-native/package.json" }}
- v3d-dependencies-{{ checksum "packages/jarl-react-native/package.json" }}
# fallback to using the latest cache if no exact match is found
- v2d-dependencies-
- v3d-dependencies-
- restore_cache:
keys:
- v2e-dependencies-{{ checksum "packages/jarl-react-redux/package.json" }}
- v3e-dependencies-{{ checksum "packages/jarl-react-redux/package.json" }}
# fallback to using the latest cache if no exact match is found
- v2e-dependencies-
- v3e-dependencies-

- run: yarn install
- run: yarn bootstrap
- run: yarn

- save_cache:
paths:
- node_modules
key: v2a-dependencies-{{ checksum "package.json" }}
key: v3a-dependencies-{{ checksum "package.json" }}
- save_cache:
paths:
- demo/node_modules
key: v2b-dependencies-{{ checksum "demo/package.json" }}
key: v3b-dependencies-{{ checksum "demo/package.json" }}
- save_cache:
paths:
- packages/jarl-react/node_modules
key: v2c-dependencies-{{ checksum "packages/jarl-react/package.json" }}
key: v3c-dependencies-{{ checksum "packages/jarl-react/package.json" }}
- save_cache:
paths:
- packages/jarl-react-native/node_modules
key: v2d-dependencies-{{ checksum "packages/jarl-react-native/package.json" }}
key: v3d-dependencies-{{ checksum "packages/jarl-react-native/package.json" }}
- save_cache:
paths:
- packages/jarl-react-redux/node_modules
key: v2e-dependencies-{{ checksum "packages/jarl-react-redux/package.json" }}
key: v3e-dependencies-{{ checksum "packages/jarl-react-redux/package.json" }}

# run tests!
- run: yarn lint
- run: yarn build
Expand All @@ -87,3 +86,61 @@ jobs:
- run:
command: yarn ci-stop
working_directory: demo

# Deploy this bad boy
# - setup_remote_docker

publish:
docker:
- image: cypress/base:8
# Could use a different image but caches will match (?) the cypress image
# - image: circleci/node:8.11.1
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v3a-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v3a-dependencies-
- restore_cache:
keys:
- v3b-dependencies-{{ checksum "demo/package.json" }}
# fallback to using the latest cache if no exact match is found
- v3b-dependencies-
- restore_cache:
keys:
- v3c-dependencies-{{ checksum "packages/jarl-react/package.json" }}
# fallback to using the latest cache if no exact match is found
- v3c-dependencies-
- restore_cache:
keys:
- v3d-dependencies-{{ checksum "packages/jarl-react-native/package.json" }}
# fallback to using the latest cache if no exact match is found
- v3d-dependencies-
- restore_cache:
keys:
- v3e-dependencies-{{ checksum "packages/jarl-react-redux/package.json" }}
# fallback to using the latest cache if no exact match is found
- v3e-dependencies-

- run: yarn
- run: yarn build
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: yarn ci-publish

workflows:
version: 2
tagged-build:
jobs:
- build
# Publish successful builds only on master with version tag
- publish:
requires:
- build
filters:
branches:
only: master
tags:
only: /^v[0-9]+(\.[0-9]+)*/
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* Added new E2E tests and fixed all the broken ones
* Started adding tests to RN package
* Improved some of the local dev scripts
* Moved to Yarn workspaces
* Continuous deployment to npm

### Bugs

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JARL React
# JARL

Just Another Router Library for React.

Expand Down
1 change: 1 addition & 0 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"cypress": "^2.1.0",
"documentation": "^6.1.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"fs-extra": "^5.0.0",
"npm-run-all": "^4.1.2",
"opn": "^5.2.0",
"postcss-loader": "^2.1.3",
Expand Down
16 changes: 8 additions & 8 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"lerna": "2.5.1",
"packages": [
"packages/jarl-react",
"packages/jarl-react-redux",
"packages/jarl-react-native",
"demo"
],
"version": "1.0.0-alpha.4"
"lerna": "2.5.1",
"version": "1.0.0-alpha.4",
"packages": [
"packages/jarl-react",
"packages/jarl-react-redux",
"packages/jarl-react-native",
"demo"
]
}
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"test": "lerna run test --stream",
"ci-test": "lerna run ci-test --stream",
"ci-e2e": "lerna run ci-e2e --stream",
"ci-publish": "lerna exec -- npm publish",
"lint": "lerna run lint --stream",
"bootstrap": "lerna bootstrap"
"bootstrap": "lerna bootstrap",
"tag-version": "lerna publish --skip-npm"
},
"devDependencies": {
"babel-eslint": "^8.2.2",
Expand All @@ -20,5 +22,15 @@
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.3.0",
"lerna": "^2.10.0"
}
},
"workspaces": {
"packages": [
"packages/jarl-react",
"packages/jarl-react-redux",
"packages/jarl-react-native",
"demo"
],
"nohoist": ["**"]
},
"version": "1.0.0-alpha-5"
}
Loading

0 comments on commit 3037df3

Please sign in to comment.