Skip to content

Commit 8638bdf

Browse files
Merge #898
898: Add beta release process r=bidoubiwa a=bidoubiwa This repository is able to create mutiple types of beta: - A normal beta for the package. Example, I add a feature in instant-meilisearch and would like to publish a beta on npm to try it out. - A beta implementing the changes of a future release of Meilisearch. [Example](#881) - A beta of a specific prototype of Meilisearch. [Example](#817) Each of these beta must run against a specific [version of Meilisearch](https://github.com/meilisearch/meilisearch/). - the normal beta has to run against the latest release of Meilisearch - the pre-release beta against the latest rc of Meilisearch - the prototype beta against the meilisearch docker image of the prototype This PR introduces the new process to make this as simple as possible. To be able to redirect the PR's to the correct tests a new formating is suggested on the branch name. For consistency, a new formating is suggested on the package version. The `check-tag-version` script ensures that if the version is not a `vX.X.X` it should be a pre-release. the `prototype-docker-version` parse the branch name to fetch the correct image on the docker API. Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents cdd57ed + 8af8bb9 commit 8638bdf

File tree

9 files changed

+106
-74
lines changed

9 files changed

+106
-74
lines changed

.github/scripts/beta-docker-version.sh

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

.github/scripts/check-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

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

66
package_file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
77
package_file_name='package.json'

.github/scripts/check-tag-format.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,24 @@ is_pre_release=$1
55
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
66

77
if [ $is_pre_release = false ]; then
8-
# Works with the format vX.X.X
8+
# Works with the format vX.X.X, X being numbers
99
#
1010
# Example of correct format:
1111
# v0.1.0
12-
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*$"
12+
echo "$current_tag" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$"
1313
if [ $? != 0 ]; then
1414
echo "Error: Your tag: $current_tag is wrongly formatted."
1515
echo 'Please refer to the contributing guide for help.'
1616
exit 1
1717
fi
1818
exit 0
1919
elif [ $is_pre_release = true ]; then
20-
# Works with the format vX.X.X-xxx-beta.X
21-
# none or multiple -xxx are valid
20+
# Works with the format vX.X.X-**.X, X being numbers
2221
#
2322
# Examples of correct format:
24-
# v0.1.0-beta.0
25-
# v0.1.0-xxx-beta.0
26-
# v0.1.0-xxx-xxx-beta.0
27-
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*-([a-z]*-)*beta\.[0-9]*$"
23+
# 0.2.0-pagination.1
24+
# 0.2.0-v0.30.0-pre-release.0
25+
echo "$current_tag" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-.*\.[0-9]*$"
2826

2927
if [ $? != 0 ]; then
3028
echo "Error: Your beta tag: $current_tag is wrongly formatted."
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
# This script is ran whenever a PR is made to implement a Meilisearch prototype.
4+
# For example if Meilisearch creates a prototype for radioactive search, the SDK may implement a way to try out the radioactive search.
5+
# Nonetheless, the tests of this implentation should run against the prototype and not the latest release of Meilisearch.
6+
# To be able to do so, Meilisearch creates a docker image with the changes.
7+
# The purpose of this script is to find the correct docker image containing the changes.
8+
# For example,
9+
# The radioactive search docker image is named `v0.30.0-radioactive-search.beta.0`
10+
# our branch is named `prototype/radioactive-search.0`
11+
# Using the branch name, this script is going to retrieve the name of the docker image.
12+
13+
# See https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables for references on GITHUB_REF_NAME
14+
prototype_branch=$1 # $GITHUB_REF_NAME
15+
prototype_branch=$(echo $prototype_branch | sed -r 's/prototype-beta\///') # remove pre-prending prototype-beta/
16+
prototype_name=$(echo $prototype_branch | sed -r 's/-beta//') # remove appended -beta
17+
18+
docker_image=$(curl "https://hub.docker.com/v2/repositories/getmeili/meilisearch/tags?&page_size=100" | jq | grep "$prototype_name" | head -1)
19+
docker_image=$(echo $docker_image | grep '"name":' | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
20+
echo $docker_image

.github/workflows/beta-tests.yml renamed to .github/workflows/meilisearch-prototype-tests.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
# Testing the code base against a specific Meilisearch feature
2-
name: Beta tests
2+
name: Meilisearch prototype tests
33

44
# Will only run for PRs and pushes to *-beta
55
on:
6-
push:
7-
branches: ['**-beta', '!bump-meilisearch-v[0-9]*.[0-9]*.[0-9]*-beta']
86
pull_request:
9-
branches: ['**-beta', '!bump-meilisearch-v[0-9]*.[0-9]*.[0-9]*-beta']
7+
branches:
8+
- 'prototype-beta/**'
9+
push:
10+
branches:
11+
- 'prototype-beta/**'
1012

1113
jobs:
1214
meilisearch-version:
1315
runs-on: ubuntu-latest
1416
outputs:
15-
version: ${{ steps.grep-step.outputs.version }}
17+
version: ${{ steps.grep-step.outputs.meilisearch_version }}
1618
steps:
1719
- uses: actions/checkout@v3
1820
- name: Grep docker beta version of Meilisearch
1921
id: grep-step
2022
run: |
21-
MEILISEARCH_VERSION=$(sh .github/scripts/beta-docker-version.sh)
22-
echo $MEILISEARCH_VERSION
23-
echo ::set-output name=version::$MEILISEARCH_VERSION
23+
MEILISEARCH_VERSION=$(sh .github/scripts/prototype-docker-version.sh $GITHUB_REF_NAME)
24+
if [ -z "$MEILISEARCH_VERSION" ]
25+
then
26+
echo "Could not find any docker image for this prototype: $GITHUB_REF_NAME"
27+
exit 1
28+
else
29+
echo $MEILISEARCH_VERSION
30+
fi
31+
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
2432
cypress-run:
2533
runs-on: ubuntu-latest
2634
needs: ['meilisearch-version']

.github/workflows/pre-release-tests.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,31 @@ name: Pre-Release Tests
33

44
# Will only run for PRs and pushes to bump-meilisearch-v*
55
on:
6-
push:
7-
branches: [bump-meilisearch-v*]
86
pull_request:
9-
branches: [bump-meilisearch-v*]
7+
branches:
8+
- 'bump-meilisearch-v**'
9+
- 'pre-release-beta/**'
10+
push:
11+
branches:
12+
- 'bump-meilisearch-v**'
13+
- 'pre-release-beta/**'
1014

1115
jobs:
1216
meilisearch-version:
1317
runs-on: ubuntu-latest
18+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
1419
outputs:
15-
version: ${{ steps.grep-step.outputs.version }}
20+
version: ${{ steps.grep-step.outputs.meilisearch_version }}
1621
steps:
1722
- uses: actions/checkout@v3
1823
- name: Grep docker beta version of Meilisearch
1924
id: grep-step
2025
run: |
2126
MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)
22-
echo $MEILISEARCH_VERSION
23-
echo ::set-output name=version::$MEILISEARCH_VERSION
27+
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
2428
cypress-run:
2529
runs-on: ubuntu-latest
30+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
2631
needs: ['meilisearch-version']
2732
services:
2833
meilisearch:
@@ -62,9 +67,9 @@ jobs:
6267
with:
6368
name: cypress-videos
6469
path: cypress/videos
65-
6670
integration_tests:
6771
runs-on: ubuntu-latest
72+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
6873
needs: ['meilisearch-version']
6974
services:
7075
meilisearch:

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
- name: Build instant-meilisearch
2222
run: yarn build
2323
- name: Publish with latest tag
24-
if: "!github.event.release.prerelease && !contains(github.ref, 'beta')"
24+
if: '!github.event.release.prerelease'
2525
run: npm publish .
2626
env:
2727
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2828
- name: Publish with beta tag
29-
if: "github.event.release.prerelease && contains(github.ref, 'beta')"
29+
if: 'github.event.release.prerelease'
3030
run: npm publish . --tag beta
3131
env:
3232
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/tests.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,16 @@ jobs:
1313
cypress-run:
1414
runs-on: ubuntu-latest
1515
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
16-
# Will still run for each push to bump-meilisearch-v*
17-
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
16+
# Will not run if the event is a PR to pre-release-beta/*
17+
# Will not run if the event is a PR to prototype-beta/*
18+
# Will not run if the event is a push on pre-release-beta/*
19+
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
20+
if: |
21+
github.event_name != 'pull_request' ||
22+
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
23+
!startsWith(github.base_ref, 'pre-release-beta/') &&
24+
!startsWith(github.base_ref, 'prototype-beta/') &&
25+
!startsWith(github.head_ref, 'pre-release-beta/')
1826
services:
1927
meilisearch:
2028
image: getmeili/meilisearch:latest
@@ -55,8 +63,16 @@ jobs:
5563
path: cypress/videos
5664
integration_tests:
5765
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
58-
# Will still run for each push to bump-meilisearch-v*
59-
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
66+
# Will not run if the event is a PR to pre-release-beta/*
67+
# Will not run if the event is a PR to prototype-beta/*
68+
# Will not run if the event is a push on pre-release-beta/*
69+
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
70+
if: |
71+
github.event_name != 'pull_request' ||
72+
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
73+
!startsWith(github.base_ref, 'pre-release-beta/') &&
74+
!startsWith(github.base_ref, 'prototype-beta/') &&
75+
!startsWith(github.head_ref, 'pre-release-beta/')
6076
runs-on: ubuntu-latest
6177
services:
6278
meilisearch:
@@ -85,9 +101,6 @@ jobs:
85101
- name: Build project
86102
run: yarn build
87103
style_tests:
88-
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
89-
# Will still run for each push to bump-meilisearch-v*
90-
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
91104
name: style-check
92105
runs-on: ubuntu-latest
93106
steps:
@@ -106,9 +119,6 @@ jobs:
106119
with:
107120
config_file: .yamllint.yml
108121
types_tests:
109-
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
110-
# Will still run for each push to bump-meilisearch-v*
111-
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
112122
runs-on: ubuntu-latest
113123
name: types-check
114124
steps:

CONTRIBUTING.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
131131

132132
⚠️ 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).
133133

134+
#### Version update
134135
Make a PR modifying the following files with the right version:
135136

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

147+
#### Github publish
146148
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`.
147149

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

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

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

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

158162
#### Release a `beta` Version
159163

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

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

164-
For example:
165-
- When implementing a beta feature, create a branch `my-feature-beta` where you implement the feature.
166-
```bash
167-
git checkout -b my-feature-beta
168-
```
169-
- During the Meilisearch pre-release, create a branch originating from `bump-meilisearch-v*.*.*` named `bump-meilisearch-v*.*.*-beta`. <br>
170-
`v*.*.*` is the next version of the package, NOT the version of Meilisearch!
171+
1. Create a new branch containing the changes with the correct name format following these rules:
172+
- `package beta`: create a branch `beta/xx-xx` with the context of your beta.
173+
Example: `beta/refactor`.
174+
- Meilisearch `pre-release beta`: create a branch originating from `bump-meilisearch-v*.*.*` named `pre-release-beta/v*.*.*`. <br>
175+
Example: `pre-release-beta/v0.30.0`
176+
- Meilisearch `prototype beta`: create a branch `prototype-beta/xx-xx`. Where `xxx` has the same name as the docker image containing the prototype.
177+
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`
171178

172-
```bash
173-
git checkout bump-meilisearch-v*.*.*
174-
git pull origin bump-meilisearch-v*.*.*
175-
git checkout -b bump-meilisearch-v*.*.*-beta
176-
```
179+
2. [Update the version](#version-update) following the correct format (X are numbers):
180+
- package and prototype beta: `X.X.X-***.X`
181+
example: `0.2.0-new-feature.0`
182+
- pre-release beta: `X.X.X-vX.X.X-pre-release.X`
183+
example: `0.2.0-v0.30.0-pre-release.0`
177184

178-
- 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.
179185

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

182-
- Create a GitHub pre-release:
188+
4. Go to the [GitHub interface for releasing](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Draft a new release`.
189+
190+
5. Create a GitHub pre-release:
183191
- Fill the description with the detailed changelogs
184-
- Fill the title with `vX.X.X-beta.0`
185-
- Fill the tag with `vX.X.X-beta.0`
186-
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
192+
- Fill the title with the version defined on step `2`, appened with a `v`. Ex: `v0.1.0`
193+
- Fill the tag with the same name as the title
194+
- ⚠️ Select the branch created on step `1` and NOT `main`
187195
- ⚠️ Click on the "This is a pre-release" checkbox
188196
- Click on "Publish release"
189197

190-
GitHub Actions will be triggered and push the beta version to [npm](https://www.npmjs.com/package/@meilisearch/instant-meilisearch).
191-
192-
💡 If you need to release a new beta for the same version (i.e. `vX.X.X-beta.1`):
193-
- merge the change into `bump-meilisearch-v*.*.*`
194-
- rebase the `vX.X.X-beta.0` branch
195-
- change the version name in [`package.json`](/package.json) and [`src/package-version`](/src/package-version.ts)
196-
- creata a pre-release via the GitHub interface
197-
198198
<hr>
199199

200200
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 ❤️

0 commit comments

Comments
 (0)