Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ jobs:
template: 'Vue InstantSearch with Vue 3'
app: 'vue-instantsearch-vue3'

release_if_needed:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Trigger a release if the latest commit is a release commit
command: yarn shipjs trigger

workflows:
version: 2.1
ci:
Expand All @@ -163,3 +175,8 @@ workflows:
- test_e2e
- test_apps_node_14
- test_apps_node_16
- release_if_needed:
filters:
branches:
only:
- master
17 changes: 0 additions & 17 deletions .release-it.json

This file was deleted.

29 changes: 7 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,32 +98,17 @@ You will need to follow these steps:

We will then review your pull request!

### Releasing
### Release

We rely on [release-it](https://github.com/webpro/release-it) to release new versions of Create InstantSearch App.
We rely on [Ship.js](https://github.com/algolia/shipjs) to release new versions of Create InstantSearch App.

#### Release flow
You need to have `GITHUB_TOKEN` added to your `.env` file. You can create a [personal access token](https://github.com/settings/tokens).

1. Bump the project version in [`package.json`](package.json) based on [the commits](#conventions)
1. Generate the changelog
1. Commit the new release
1. Create the new release tag
1. Push to GitHub
1. Create the new release on GitHub
1. Publish to npm
1. Push the generated templates to the [`templates`](https://github.com/algolia/create-instantsearch-app/tree/templates) branch (usable on CodeSandbox)

#### Release steps

To release a new version of the package, you need to:
```sh
yarn release
```

1. [Generate a new GitHub token](https://github.com/settings/tokens/new) with the scope `repo` (necessary for creating GitHub releases)
1. Store this token in an [environment variable](https://en.wikipedia.org/wiki/Environment_variable) called `GITHUB_TOKEN_CISA`
1. Make sure you're on the `master` branch
1. Run commands (_do not_ use `yarn` for releasing):
- `npm run release:beta` for a new beta version
- `npm run release` for a new stable version
1. Follow the command-line instructions
It will create a pull request for the next release. When it's reviewed, approved and merged, CircleCI will automatically publish it to npm.

### Updating templates on CodeSandbox

Expand Down
15 changes: 4 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"version": "6.0.0",
"license": "MIT",
"description": "⚡️ Build InstantSearch apps at the speed of thought",
"keywords": [
"algolia",
"instantsearch"
],
"keywords": ["algolia", "instantsearch"],
"repository": "algolia/create-instantsearch-app",
"author": "Algolia <support@algolia.com>",
"main": "index.js",
Expand All @@ -25,13 +22,9 @@
"doctoc": "doctoc --maxlevel 3 README.md CONTRIBUTING.md docs/",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release-templates": "node ./scripts/release-templates",
"release": "release-it",
"release:beta": "release-it --preRelease=beta"
"release": "shipjs prepare"
},
"files": [
"index.js",
"src"
],
"files": ["index.js", "src"],
"engines": {
"node": ">= 10"
},
Expand Down Expand Up @@ -67,7 +60,7 @@
"eslint-plugin-prettier": "3.1.2",
"jest": "25.1.0",
"jest-image-snapshot": "2.12.0",
"release-it": "10.4.5",
"shipjs": "0.24.4",
"walk-sync": "2.0.2"
}
}
9 changes: 8 additions & 1 deletion scripts/release-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,17 @@ async function build() {

execSync(`git commit -m "${commitMessage}"`);

// Use the `origin-with-token` remote if it exists (when run with Ship.js)
const origin = execSync(
`git remote | grep origin-with-token || echo origin`
)
.toString()
.trim();

// Push the new demos to the `templates` branch
console.log();
console.log(`▶︎ Pushing to branch "${chalk.green(TEMPLATES_BRANCH)}"`);
execSync(`git push origin ${TEMPLATES_BRANCH}`);
execSync(`git push ${origin} ${TEMPLATES_BRANCH}`);
Comment on lines +127 to +137
Copy link
Member Author

Choose a reason for hiding this comment

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

Because the release process is now performed within CircleCI, this modification allows the script to push on the token-authenticated remote Ship.js uses to push the new tag.

I don't know how to test if beforehands though, but it should work. Wdyt @Haroenv @sarahdayan @FabienMotte?

Copy link
Member

Choose a reason for hiding this comment

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

LGTM, we can always revert if it doesn't work for the next deploy.


console.log();
console.log(
Expand Down
11 changes: 11 additions & 0 deletions ship.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
shouldPrepare: ({ releaseType, commitNumbersPerType }) => {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
buildCommand: () => null,
afterPublish: ({ exec }) => exec('yarn run release-templates'),
};
Loading