Skip to content
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
9 changes: 0 additions & 9 deletions .github/scripts/beta-docker-version.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')

package_file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
package_file_name='package.json'
Expand Down
14 changes: 6 additions & 8 deletions .github/scripts/check-tag-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@ is_pre_release=$1
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)

if [ $is_pre_release = false ]; then
# Works with the format vX.X.X
# Works with the format vX.X.X, X being numbers
#
# Example of correct format:
# v0.1.0
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*$"
echo "$current_tag" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$"
if [ $? != 0 ]; then
echo "Error: Your tag: $current_tag is wrongly formatted."
echo 'Please refer to the contributing guide for help.'
exit 1
fi
exit 0
elif [ $is_pre_release = true ]; then
# Works with the format vX.X.X-xxx-beta.X
# none or multiple -xxx are valid
# Works with the format vX.X.X-**.X, X being numbers
#
# Examples of correct format:
# v0.1.0-beta.0
# v0.1.0-xxx-beta.0
# v0.1.0-xxx-xxx-beta.0
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*-([a-z]*-)*beta\.[0-9]*$"
# 0.2.0-pagination.1
# 0.2.0-v0.30.0-pre-release.0
echo "$current_tag" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-.*\.[0-9]*$"

if [ $? != 0 ]; then
echo "Error: Your beta tag: $current_tag is wrongly formatted."
Expand Down
20 changes: 20 additions & 0 deletions .github/scripts/prototype-docker-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# This script is ran whenever a PR is made to implement a Meilisearch prototype.
# For example if Meilisearch creates a prototype for radioactive search, the SDK may implement a way to try out the radioactive search.
# Nonetheless, the tests of this implentation should run against the prototype and not the latest release of Meilisearch.
# To be able to do so, Meilisearch creates a docker image with the changes.
# The purpose of this script is to find the correct docker image containing the changes.
# For example,
# The radioactive search docker image is named `v0.30.0-radioactive-search.beta.0`
# our branch is named `prototype/radioactive-search.0`
# Using the branch name, this script is going to retrieve the name of the docker image.

# See https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables for references on GITHUB_REF_NAME
prototype_branch=$1 # $GITHUB_REF_NAME
prototype_branch=$(echo $prototype_branch | sed -r 's/prototype-beta\///') # remove pre-prending prototype-beta/
prototype_name=$(echo $prototype_branch | sed -r 's/-beta//') # remove appended -beta

docker_image=$(curl "https://hub.docker.com/v2/repositories/getmeili/meilisearch/tags?&page_size=100" | jq | grep "$prototype_name" | head -1)
docker_image=$(echo $docker_image | grep '"name":' | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
echo $docker_image
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Testing the code base against a specific Meilisearch feature
name: Beta tests
name: Meilisearch prototype tests

# Will only run for PRs and pushes to *-beta
on:
push:
branches: ['**-beta', '!bump-meilisearch-v[0-9]*.[0-9]*.[0-9]*-beta']
pull_request:
branches: ['**-beta', '!bump-meilisearch-v[0-9]*.[0-9]*.[0-9]*-beta']
branches:
- 'prototype-beta/**'
push:
branches:
- 'prototype-beta/**'

jobs:
meilisearch-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.grep-step.outputs.version }}
version: ${{ steps.grep-step.outputs.meilisearch_version }}
steps:
- uses: actions/checkout@v3
- name: Grep docker beta version of Meilisearch
id: grep-step
run: |
MEILISEARCH_VERSION=$(sh .github/scripts/beta-docker-version.sh)
echo $MEILISEARCH_VERSION
echo ::set-output name=version::$MEILISEARCH_VERSION
MEILISEARCH_VERSION=$(sh .github/scripts/prototype-docker-version.sh $GITHUB_REF_NAME)
if [ -z "$MEILISEARCH_VERSION" ]
then
echo "Could not find any docker image for this prototype: $GITHUB_REF_NAME"
exit 1
else
echo $MEILISEARCH_VERSION
fi
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
cypress-run:
runs-on: ubuntu-latest
needs: ['meilisearch-version']
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@ name: Pre-Release Tests

# Will only run for PRs and pushes to bump-meilisearch-v*
on:
push:
branches: [bump-meilisearch-v*]
pull_request:
branches: [bump-meilisearch-v*]
branches:
- 'bump-meilisearch-v**'
- 'pre-release-beta/**'
push:
branches:
- 'bump-meilisearch-v**'
- 'pre-release-beta/**'

jobs:
meilisearch-version:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
outputs:
version: ${{ steps.grep-step.outputs.version }}
version: ${{ steps.grep-step.outputs.meilisearch_version }}
steps:
- uses: actions/checkout@v3
- name: Grep docker beta version of Meilisearch
id: grep-step
run: |
MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)
echo $MEILISEARCH_VERSION
echo ::set-output name=version::$MEILISEARCH_VERSION
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
cypress-run:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
needs: ['meilisearch-version']
services:
meilisearch:
Expand Down Expand Up @@ -62,9 +67,9 @@ jobs:
with:
name: cypress-videos
path: cypress/videos

integration_tests:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
needs: ['meilisearch-version']
services:
meilisearch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
- name: Build instant-meilisearch
run: yarn build
- name: Publish with latest tag
if: "!github.event.release.prerelease && !contains(github.ref, 'beta')"
if: '!github.event.release.prerelease'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the step Check tag format we ensure that, in the case we are in a latest release and not a pre-release, the version of the package is strictly formatted as vX.X.X and not for example vX.X.X-my-feature.0.
With that check, we do not need the second condition anymore.

run: npm publish .
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish with beta tag
if: "github.event.release.prerelease && contains(github.ref, 'beta')"
if: 'github.event.release.prerelease'
run: npm publish . --tag beta
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
30 changes: 20 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ jobs:
cypress-run:
runs-on: ubuntu-latest
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
# Will not run if the event is a PR to pre-release-beta/*
# Will not run if the event is a PR to prototype-beta/*
# Will not run if the event is a push on pre-release-beta/*
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
if: |
github.event_name != 'pull_request' ||
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
!startsWith(github.base_ref, 'pre-release-beta/') &&
!startsWith(github.base_ref, 'prototype-beta/') &&
!startsWith(github.head_ref, 'pre-release-beta/')
services:
meilisearch:
image: getmeili/meilisearch:latest
Expand Down Expand Up @@ -55,8 +63,16 @@ jobs:
path: cypress/videos
integration_tests:
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
# Will not run if the event is a PR to pre-release-beta/*
# Will not run if the event is a PR to prototype-beta/*
# Will not run if the event is a push on pre-release-beta/*
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
if: |
github.event_name != 'pull_request' ||
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
!startsWith(github.base_ref, 'pre-release-beta/') &&
!startsWith(github.base_ref, 'prototype-beta/') &&
!startsWith(github.head_ref, 'pre-release-beta/')
runs-on: ubuntu-latest
services:
meilisearch:
Expand Down Expand Up @@ -85,9 +101,6 @@ jobs:
- name: Build project
run: yarn build
style_tests:
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
name: style-check
runs-on: ubuntu-latest
steps:
Expand All @@ -106,9 +119,6 @@ jobs:
with:
config_file: .yamllint.yml
types_tests:
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
runs-on: ubuntu-latest
name: types-check
steps:
Expand Down
58 changes: 29 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m

⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).

#### Version update
Make a PR modifying the following files with the right version:

[`package.json`](/package.json):
Expand All @@ -143,58 +144,57 @@ Make a PR modifying the following files with the right version:
export const PACKAGE_VERSION = 'X.X.X'
```

#### Github publish
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommendations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.

GitHub Actions will be triggered and push the package to [npm](https://www.npmjs.com/package/@meilisearch/instant-meilisearch).

#### Codesandbox update
Once the version is available on npm, please update the instant-meilisearch version used in the different Code-Sandboxes we provide:

- [Meilisearch + InstantSearch](https://codesandbox.io/s/ms-is-mese9)
- [Meilisearch + Vue InstantSearch](https://codesandbox.io/s/ms-vue-is-1d6bi)
- [Meilisearch + Vue 2 InstantSearch](https://codesandbox.io/s/ms-vue-is-1d6bi)
- [Meilisearch + Vue 3 InstantSearch](https://codesandbox.io/s/ms-vue3-is-0293zk)
- [Meilisearch + React InstantSearch](https://codesandbox.io/s/ms-react-is-sh9ud)

If you don't have the access to do it, please request it internally.

#### Release a `beta` Version

Here are the steps to release a beta version of this package:
This package is able to create multiple types of betas:
- A standard package beta, working on the latest version of Meilisearch.
- A beta implementing the changes of a rc version of Meilisearch.
- A beta implementing a specific feature `prototype` of Meilisearch.

- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.
Here are the steps to release a beta version of this package depending on its type:

For example:
- When implementing a beta feature, create a branch `my-feature-beta` where you implement the feature.
```bash
git checkout -b my-feature-beta
```
- During the Meilisearch pre-release, create a branch originating from `bump-meilisearch-v*.*.*` named `bump-meilisearch-v*.*.*-beta`. <br>
`v*.*.*` is the next version of the package, NOT the version of Meilisearch!
1. Create a new branch containing the changes with the correct name format following these rules:
- `package beta`: create a branch `beta/xx-xx` with the context of your beta.
Example: `beta/refactor`.
- Meilisearch `pre-release beta`: create a branch originating from `bump-meilisearch-v*.*.*` named `pre-release-beta/v*.*.*`. <br>
Example: `pre-release-beta/v0.30.0`
- Meilisearch `prototype beta`: create a branch `prototype-beta/xx-xx`. Where `xxx` has the same name as the docker image containing the prototype.
Example: If the [docker image](https://hub.docker.com/r/getmeili/meilisearch/tags) is named: `v0.29.0-pagination.beta.2`, the branch should be named: `prototype-beta/pagination`

```bash
git checkout bump-meilisearch-v*.*.*
git pull origin bump-meilisearch-v*.*.*
git checkout -b bump-meilisearch-v*.*.*-beta
```
2. [Update the version](#version-update) following the correct format (X are numbers):
- package and prototype beta: `X.X.X-***.X`
example: `0.2.0-new-feature.0`
- pre-release beta: `X.X.X-vX.X.X-pre-release.X`
example: `0.2.0-v0.30.0-pre-release.0`

- Change the version in [`package.json`](/package.json) and [`src/package-version`](/src/package-version.ts) with `*.*.*-xxx-beta.0` and commit it to the `v*.*.*-beta` branch.

- Go to the [GitHub interface for releasing](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Draft a new release`.
3. Commit and push your code to the newly created branch (step 1).

- Create a GitHub pre-release:
4. Go to the [GitHub interface for releasing](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Draft a new release`.

5. Create a GitHub pre-release:
- Fill the description with the detailed changelogs
- Fill the title with `vX.X.X-beta.0`
- Fill the tag with `vX.X.X-beta.0`
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
- Fill the title with the version defined on step `2`, appened with a `v`. Ex: `v0.1.0`
- Fill the tag with the same name as the title
- ⚠️ Select the branch created on step `1` and NOT `main`
- ⚠️ Click on the "This is a pre-release" checkbox
- Click on "Publish release"

GitHub Actions will be triggered and push the beta version to [npm](https://www.npmjs.com/package/@meilisearch/instant-meilisearch).

💡 If you need to release a new beta for the same version (i.e. `vX.X.X-beta.1`):
- merge the change into `bump-meilisearch-v*.*.*`
- rebase the `vX.X.X-beta.0` branch
- change the version name in [`package.json`](/package.json) and [`src/package-version`](/src/package-version.ts)
- creata a pre-release via the GitHub interface

<hr>

Thank you again for reading this through. We can not wait to begin to work with you if you make your way through this contributing guide ❤️