Skip to content

Commit e2bdfe1

Browse files
Merge #1447
1447: Improve beta release process r=bidoubiwa a=bidoubiwa Based on this: https://github.com/meilisearch/instant-meilisearch/pull/898/files It introduces consistency in the beta naming branches and ensures that the release works as expected. Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents d7572e6 + 14d06f3 commit e2bdfe1

File tree

7 files changed

+86
-56
lines changed

7 files changed

+86
-56
lines changed
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
#!/bin/sh
22

3-
package_json_version=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
4-
beta_feature=$(echo $package_json_version | sed -r 's/[0-9]+.[0-9]+.[0-9]+-//')
5-
beta_feature=$(echo $beta_feature | sed -r 's/-beta\.[0-9]*$//')
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 `prototype-radioactive-search-0`
10+
# our branch is named `prototype-beta/prototype-radioactive-search`
11+
# Using the branch name, this script is going to retrieve the name of the docker image.
612

7-
docker_image=$(curl https://hub.docker.com/v2/repositories/getmeili/meilisearch/tags | jq | grep "$beta_feature" | head -1)
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+
17+
docker_image=$(curl "https://hub.docker.com/v2/repositories/getmeili/meilisearch/tags?&page_size=100" | jq | grep "$prototype_name" | head -1)
818
docker_image=$(echo $docker_image | grep '"name":' | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
919
echo $docker_image

.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."

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

Lines changed: 17 additions & 9 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

4-
# Will only run for PRs and pushes to *-beta and not the bump betas
4+
# 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
integration_tests:
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
@@ -1,28 +1,33 @@
11
# Testing the code base against the Meilisearch pre-releases
22
name: Pre-Release Tests
33

4-
# # Will only run for PRs and pushes to bump-meilisearch-v*
4+
# 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
integration_tests:
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:

.github/workflows/publish.yml

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

.github/workflows/tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ on:
1212
jobs:
1313
integration_tests:
1414
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
15-
# Will still run for each push to bump-meilisearch-v*
16-
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
15+
# Will not run if the event is a PR to pre-release-beta/*
16+
# Will not run if the event is a PR to prototype-beta/*
17+
# Will not run if the event is a push on pre-release-beta/*
18+
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
19+
if: |
20+
github.event_name != 'pull_request' ||
21+
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
22+
!startsWith(github.base_ref, 'pre-release-beta/') &&
23+
!startsWith(github.base_ref, 'prototype-beta/') &&
24+
!startsWith(github.head_ref, 'pre-release-beta/')
1725
runs-on: ubuntu-latest
1826
services:
1927
meilisearch:

CONTRIBUTING.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
115115

116116
⚠️ 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).
117117

118+
#### Version update
119+
118120
Make a PR modifying the following files with the right version:
119121

120122
[`package.json`](/package.json):
@@ -127,49 +129,48 @@ Make a PR modifying the following files with the right version:
127129
export const PACKAGE_VERSION = 'X.X.X'
128130
```
129131

132+
#### Github publish
133+
130134
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-js/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`.
131135

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

134138
#### Release a `beta` Version
135139

136-
Here are the steps to release a beta version of this package:
140+
This package is able to create multiple types of betas:
141+
- A standard package beta, working on the latest version of Meilisearch.
142+
- A beta implementing the changes of a rc version of Meilisearch.
143+
- A beta implementing a specific feature `prototype` of Meilisearch.
144+
145+
Here are the steps to release a beta version of this package depending on its type:
137146

138-
- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.
147+
1. Create a new branch containing the changes with the correct name format following these rules:
148+
- `package beta`: create a branch `beta/xx-xx` with the context of your beta.
149+
Example: `beta/refactor`.
150+
- Meilisearch `pre-release beta`: create a branch originating from `bump-meilisearch-v*.*.*` named `pre-release-beta/v*.*.*`. <br>
151+
Example: `pre-release-beta/v0.30.0`
152+
- Meilisearch `prototype beta`: create a branch `prototype-beta/xx-xx`. Where `xxx` has the same name as the docker image containing the prototype.
153+
Example: If the [docker image](https://hub.docker.com/r/getmeili/meilisearch/tags) is named: `prototype-multi-search-0`, the branch should be named: `prototype-beta/prototype-multi-search`
139154

140-
For example:
141-
- When implementing a beta feature, create a branch `my-feature-beta` where you implement the feature.
142-
```bash
143-
git checkout -b my-feature-beta
144-
```
145-
- During the Meilisearch pre-release, create a branch originating from `bump-meilisearch-v*.*.*` named `bump-meilisearch-v*.*.*-beta`. <br>
146-
`v*.*.*` is the next version of the package, NOT the version of Meilisearch!
155+
2. [Update the version](#version-update) following the correct format (X are numbers):
156+
- package and prototype beta: `X.X.X-***.X`
157+
example: `0.2.0-new-feature.0`
158+
- pre-release beta: `X.X.X-vX.X.X-pre-release.X`
159+
example: `0.2.0-v0.30.0-pre-release.0`
147160

148-
```bash
149-
git checkout bump-meilisearch-v*.*.*
150-
git pull origin bump-meilisearch-v*.*.*
151-
git checkout -b bump-meilisearch-v*.*.*-beta
152-
```
161+
3. Commit and push your code to the newly created branch (step 1).
153162

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

156-
- Go to the [GitHub interface for releasing](https://github.com/meilisearch/meilisearch-js/releases): on this page, click on `Draft a new release`.
164+
4. Go to the [GitHub interface for releasing](https://github.com/meilisearch/meilisearch-js/releases): on this page, click on `Draft a new release`.
157165

158-
- Create a GitHub pre-release:
166+
5. Create a GitHub pre-release:
159167
- Fill the description with the detailed changelogs
160168
- Fill the title with `vX.X.X-beta.0`
161169
- Fill the tag with `vX.X.X-beta.0`
162170
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
163171
- ⚠️ Click on the "This is a pre-release" checkbox
164172
- Click on "Publish release"
165173

166-
GitHub Actions will be triggered and push the beta version to [npm](https://www.npmjs.com/package/meilisearch).
167-
168-
💡 If you need to release a new beta for the same version (i.e. `vX.X.X-beta.1`):
169-
- merge the change into your beta branch
170-
- change the version name in [`package.json`](/package.json) and in [`src/package-version`](/src/package-version.ts)
171-
- creata a pre-release via the GitHub interface
172-
173174
<hr>
174175

175176
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)