Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 03746c5

Browse files
author
Eunjae Lee
authored
chore(release): add shipjs (#3017)
* chore(release): add shipjs * update examples afterPublish
1 parent 682ee6d commit 03746c5

File tree

12 files changed

+1223
-171
lines changed

12 files changed

+1223
-171
lines changed

.circleci/config.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,33 @@ jobs:
118118
name: Build & Test examples
119119
command: yarn test:examples
120120

121+
release_if_needed:
122+
<<: *defaults
123+
steps:
124+
- checkout
125+
- run: *install_yarn_version
126+
- restore_cache: *restore_yarn_cache
127+
- run: *run_yarn_install
128+
- save_cache: *save_yarn_cache
129+
- run:
130+
name: Trigger a release if the latest commit is a release commit
131+
command: yarn shipjs trigger
132+
133+
prepare_release:
134+
<<: *defaults
135+
steps:
136+
- checkout
137+
- run: *install_yarn_version
138+
- restore_cache: *restore_yarn_cache
139+
- run: *run_yarn_install
140+
- save_cache: *save_yarn_cache
141+
- run:
142+
name: Prepare a pull request for next release
143+
command: |
144+
git config --global user.email "[email protected]"
145+
git config --global user.name "InstantSearch"
146+
yarn run release --yes --no-browse
147+
121148
workflows:
122149
version: 2
123150
ci:
@@ -128,3 +155,19 @@ workflows:
128155
- test_integration
129156
- test_e2e
130157
- test_examples
158+
- release_if_needed:
159+
filters:
160+
branches:
161+
only:
162+
- master
163+
- next
164+
scheduled_release:
165+
triggers:
166+
- schedule:
167+
cron: '0 9 * * 2'
168+
filters:
169+
branches:
170+
only:
171+
- master
172+
jobs:
173+
- prepare_release

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ Files are automatically formatted with Prettier.
5858

5959
## Release
6060

61+
You need to have `GITHUB_TOKEN` added to your `.env` file. You can create a [personal access token](https://github.com/settings/tokens).
62+
6163
```sh
6264
yarn release
6365
```
6466

67+
It will create a pull request for the next release. When it's reviewed, approved and merged, then CircleCI will automatically publish it to npm.
68+
6569
### Beta release
6670

6771
```sh
68-
yarn release --beta
72+
yarn release
6973
```
7074

71-
Append `-beta.x` where x is a number to the version for beta, so 4.0.0-beta.2 for example.
75+
The script will ask you a question about the next version. If it's wrong, you can say "No" and specify the version (e.g. "7.0.0-beta.0"). Then, it will open a pull request for that release. When the pull request is merged, CircleCI will publish it to npm with a `--tag beta` argument.
7276

7377
## Update docs
7478

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"start": "yarn storybook",
1212
"build": "lerna run build --scope react-*",
1313
"watch": "lerna run watch --scope react-instantsearch-* --parallel",
14-
"release": "scripts/release.sh",
14+
"release": "shipjs prepare",
1515
"lint": "eslint --ext .js,.ts,.tsx .",
1616
"lint:fix": "eslint --ext .js,.ts,.tsx --fix .",
1717
"type-check": "tsc",
@@ -126,6 +126,7 @@
126126
"rollup-plugin-node-resolve": "5.2.0",
127127
"rollup-plugin-replace": "2.2.0",
128128
"rollup-plugin-uglify": "6.0.3",
129+
"shipjs": "0.23.0",
129130
"style-loader": "1.0.0",
130131
"typescript": "3.8.3",
131132
"webpack": "4.40.2",

packages/react-instantsearch-core/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
"build": "yarn build:cjs && yarn build:es && yarn build:umd",
3434
"build:cjs": "babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/cjs --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
3535
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
36-
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js",
37-
"release": "yarn clean && yarn build && yarn publish --non-interactive",
38-
"release:beta": "yarn clean && yarn build && yarn publish --tag beta --non-interactive"
36+
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js"
3937
},
4038
"dependencies": {
4139
"@babel/runtime": "^7.1.2",

packages/react-instantsearch-dom-maps/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
"build": "yarn build:cjs && yarn build:es && yarn build:umd",
3737
"build:cjs": "babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/cjs --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
3838
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
39-
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js",
40-
"release": "yarn clean && yarn build && yarn publish --non-interactive",
41-
"release:beta": "yarn clean && yarn build && yarn publish --tag beta --non-interactive"
39+
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js"
4240
},
4341
"dependencies": {
4442
"@babel/runtime": "^7.1.2",

packages/react-instantsearch-dom/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
"build": "yarn build:cjs && yarn build:es && yarn build:umd",
3636
"build:cjs": "babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/cjs --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
3737
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
38-
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js",
39-
"release": "yarn clean && yarn build && yarn publish --non-interactive",
40-
"release:beta": "yarn clean && yarn build && yarn publish --tag beta --non-interactive"
38+
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js"
4139
},
4240
"dependencies": {
4341
"@babel/runtime": "^7.1.2",

packages/react-instantsearch-native/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
"watch": "yarn build:cjs --watch",
3434
"build": "yarn build:cjs && yarn build:es",
3535
"build:cjs": "babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/cjs --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
36-
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet",
37-
"release": "yarn clean && yarn build && yarn publish --non-interactive",
38-
"release:beta": "yarn clean && yarn build && yarn publish --tag beta --non-interactive"
36+
"build:es": "BABEL_ENV=es babel src --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --ignore '**/__tests__/**/*','**/__mocks__/**/*' --quiet"
3937
},
4038
"dependencies": {
4139
"@babel/runtime": "^7.1.2",

packages/react-instantsearch/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
"build:cjs": "babel connectors.js dom.js index.js native.js server.js --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist --quiet",
3232
"build:es": "BABEL_ENV=es babel connectors.js dom.js index.js native.js server.js --root-mode upward --extensions '.js,.ts,.tsx' --out-dir dist/es --quiet",
3333
"build:umd": "BABEL_ENV=rollup rollup -c rollup.config.js",
34-
"preparePackageFolder": "mkdir -p dist && cp {package.json,README.md} dist",
35-
"release": "yarn clean && yarn preparePackageFolder && yarn build && cd dist && yarn publish --non-interactive",
36-
"release:beta": "yarn clean && yarn preparePackageFolder && yarn build && cd dist && yarn publish --tag beta --non-interactive"
34+
"preparePackageFolder": "cp package.json dist && cp ../../README.md dist",
35+
"prepublishOnly": "yarn run preparePackageFolder"
3736
},
3837
"dependencies": {
3938
"@babel/runtime": "^7.1.2",

scripts/release.sh

Lines changed: 0 additions & 144 deletions
This file was deleted.

scripts/update-examples.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ const glob = require('glob');
33
const execSync = require('child_process').execSync;
44
const [version] = process.argv.slice(2);
55

6+
execSync('yarn');
7+
execSync(`yarn upgrade react-instantsearch-dom@${version} -D`);
8+
execSync(`yarn upgrade react-instantsearch-dom-maps@${version} -D`);
9+
610
const examplesPath = path.join(__dirname, '..', 'examples');
711

812
{
@@ -47,3 +51,7 @@ const examplesPath = path.join(__dirname, '..', 'examples');
4751
);
4852
});
4953
}
54+
55+
const commitMessage = `chore(deps): update examples to react-instantsearch v${version}`;
56+
execSync('git add examples package.json yarn.lock');
57+
execSync(`printf "${commitMessage}" | git commit --file -`);

0 commit comments

Comments
 (0)