Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-release #40

Merged
merged 3 commits into from Jan 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .autorc
@@ -0,0 +1,12 @@
{
"no-version-prefix": true,
"onlyPublishWithReleaseLabel": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this project is published to npm as beta and I have no idea how auto-update will handle it, I've configured the project to only release when the release label is present. @alloy after this transitions from beta you can remove this configuration. Until then you probably want to release it by hand...

"name": "Artsy",
"email": "it@artsymail.com",
"labels": {
"major": "Version: Major",
"minor": "Version: Minor",
"patch": "Version: Patch",
},
"noReleaseLabels": ["Version: Trivial", "Skip Release"]
}
94 changes: 37 additions & 57 deletions .circleci/config.yml
@@ -1,79 +1,59 @@
defaults: &defaults
working_directory: ~/artsy/react-responsive-media
docker:
- image: circleci/node:8
version: 2.1

save_cache: &save_cache
save_cache:
key: yarn-deps-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
orbs:
node: artsy/node@0.1.0
yarn: artsy/yarn@0.0.2

restore_cache: &restore_cache
restore_cache:
keys:
- yarn-deps-{{ checksum "yarn.lock" }}
- yarn-deps-

verify_dependencies: &verify_dependencies
run: yarn --check-files

filter_master: &filter_master
filters:
branches:
only:
- master

version: 2
jobs:
update-cache:
<<: *defaults
lint:
executor: node/build
steps:
- checkout
- <<: *restore_cache
- <<: *verify_dependencies
- <<: *save_cache
- yarn/setup
- run: yarn lint
type-check:
<<: *defaults
executor: node/build
steps:
- checkout
- <<: *restore_cache
- <<: *verify_dependencies
- yarn/setup
- run: yarn type-check
lint:
<<: *defaults
deploy:
executor: node/build
steps:
- checkout
- <<: *restore_cache
- <<: *verify_dependencies
- run: yarn lint
- add_ssh_keys
- yarn/setup
# Setup the .npmrc with the proper registry and auth token to publish
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: yarn release
test:
<<: *defaults
executor: node/build
steps:
- checkout
- <<: *restore_cache
- <<: *verify_dependencies
- run: yarn jest
deploy:
<<: *defaults
- yarn/setup
# Runs jest tests with 6 concurrent workers. Without limiting it to 6
# workers Jest will spawn many memory hungry workers and ultimately
# starve the job for memory.
- run: yarn test -w 6
update-cache:
executor: node/build
steps:
- checkout
- <<: *restore_cache
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: yarn semantic-release
- yarn/update_dependencies

workflows:
version: 2
build_and_verify:
jobs:
- update-cache
- type-check
- lint
- type-check
- test
- deploy:
# The deploy job is the _only_ job that should have access to our npm
# tokens. We include a context that has our publish credentials
# explicitly in this step. https://circleci.com/docs/2.0/contexts/
context: npm-deploy
<<: *filter_master
filters:
branches:
only:
- master
requires:
- update-cache
- test
- lint
- type-check
- test
- update-cache
43 changes: 9 additions & 34 deletions README.md
Expand Up @@ -387,51 +387,26 @@ if you have suggestions.

<details>

Circle CI is set up to publish releases to NPM automatically via
[semantic-release][semantic-release] following every successful merge to master.
This project uses [auto-release](https://github.com/intuit/auto-release#readme) to automatically release on every PR. Every PR should have a label that matches one of the following

Release versions (major, minor, patch) are triggered
[by commit messages][release-commit-message-format], when they adhere to
[Ember conventions][ember-release-format]:
- Version: Trivial
- Version: Patch
- Version: Minor
- Version: Major

```
[TAG context] commit message
```

[Valid tags][release-tags] for release include PATCH, DOC, FIX (patch), FEATURE
(minor), and BREAKING (major). A context is also required. Commits that do not
adhere to this convention will not trigger an NPM release.

##### Example Patch Release

```
[FIX typeface] Add missing unit
[PATCH tooling] Bump version
```
Major, minor, and patch will cause a new release to be generated. Use major for breaking changes, minor for new non-breaking features,
and patch for bug fixes. Trivial will not cause a release and should be used when updating documentation or non-project code.

##### Example Minor (Feature) Release

```
[FEATURE ios] Add View primitive
```

##### Example Major (Breaking) Release

```
[BREAKING refactor] Update API to support new platform
```
If you don't want to release on a particular PR but the changes aren't trivial then use the `Skip Release` tag along side the appropriate version tag.

</details>

[ci]: https://circleci.com/gh/artsy/react-responsive-media
[ci-icon]: https://circleci.com/gh/artsy/react-responsive-media.svg?style=shield
[npm]: https://www.npmjs.com/package/@artsy/react-responsive-media
[npm-icon]: https://badge.fury.io/js/%40artsy%2Fresponsive.svg
[npm-icon]: https://badge.fury.io/js/%40artsy%2Freact-responsive-media.svg
[react-responsive]: https://github.com/contra/react-responsive
[react-media]: https://github.com/ReactTraining/react-media
[match-media-api]: https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
[new-issue]: https://github.com/artsy/react-responsive-media/issues/new
[semantic-release]: https://github.com/semantic-release/semantic-release
[release-commit-message-format]: https://github.com/semantic-release/semantic-release#commit-message-format
[ember-release-format]: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-ember/readme.md
[release-tags]: https://github.com/artsy/react-responsive-media/blob/master/package.json
39 changes: 7 additions & 32 deletions package.json
Expand Up @@ -6,23 +6,26 @@
"files": [
"dist"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"typings": "dist/index.d.ts",
"scripts": {
"clean": "rm -rf dist",
"compile": "babel src --out-dir dist -s --source-map --extensions '.ts,.tsx' --ignore src/**/__tests__",
"example": "babel-node --extensions '.js,.jsx,.ts,.tsx' example/server.tsx",
"lint": "tslint -c tslint.json --project tsconfig.json",
"precommit": "lint-staged",
"prepush": "yarn run type-check",
"prepublishOnly": "yarn clean && yarn compile && yarn type-declarations",
"prettier": "prettier",
"prettier-project": "yarn prettier-write 'src/**/*.{ts,tsx}'",
"prettier-write": "yarn prettier --write",
"semantic-release": "semantic-release",
"release": "auto shipit",
"test": "yarn type-check && yarn lint && yarn jest",
"type-check": "tsc --emitDeclarationOnly --pretty",
"type-declarations": "tsc --emitDeclarationOnly",
"watch": "concurrently --raw --kill-others 'yarn compile -w' 'tsc --emitDeclarationOnly -w'",
"example": "babel-node --extensions '.js,.jsx,.ts,.tsx' example/server.tsx"
"watch": "concurrently --raw --kill-others 'yarn compile -w' 'tsc --emitDeclarationOnly -w'"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -57,13 +60,13 @@
"@types/react-dom": "^16.0.9",
"@types/react-test-renderer": "^16.0.3",
"@types/webpack-dev-server": "^3.1.1",
"auto-release-cli": "^1.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"babel-loader": "^8.0.4",
"babel-preset-env": "^1.7.0",
"chalk": "^2.4.1",
"concurrently": "^3.5.1",
"conventional-changelog-ember": "^2.0.0",
"express": "^4.16.4",
"husky": "^0.14.3",
"jest": "^23.1.0",
Expand All @@ -73,7 +76,6 @@
"react": "16.3.2",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.6.0",
"semantic-release": "^15.5.0",
"static-extend": "^0.1.2",
"styled-components": "^3.3.2",
"tslint": "^5.10.0",
Expand All @@ -97,33 +99,6 @@
"trailingComma": "es5",
"bracketSpacing": true
},
"release": {
"analyzeCommits": {
"preset": "ember",
"releaseRules": [
{
"tag": "DOC",
"release": "patch"
},
{
"tag": "FIX",
"release": "patch"
},
{
"tag": "PATCH",
"release": "patch"
},
{
"tag": "FEATURE",
"release": "minor"
},
{
"tag": "BREAKING",
"release": "major"
}
]
}
},
"jest": {
"transform": {
".(ts|tsx)": "babel-jest"
Expand Down