Skip to content
12 changes: 9 additions & 3 deletions .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
if [ "$current_tag" != "$file_tag" ]; then

package_file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
package_file_name="package.json"
version_file_tag=$(grep "PACKAGE_VERSION =" src/package-version.ts | cut -d "=" -f 2- | tr -d " " | tr -d "'")
version_file_name="src/package-version.ts"

if [ "$current_tag" != "$package_file_tag" ] || [ "$current_tag" != "$version_file_tag"]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$current_tag vs $file_tag"
echo "$package_file_name: $current_tag vs $package_file_tag"
echo "$version_file_name: $current_tag vs $version_file_tag"
exit 1
fi

Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,16 @@ _[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).

Make a PR modifying the file [`package.json`](/package.json) with the right version.
Make a PR modifying the following files with the right version:

[`package.json`](/package.json):
```javascript
"version": "X.X.X"
"version": "X.X.X",
```

[`src/package-version`](/src/package-version.ts)
```javascript
export const PACKAGE_VERSION = 'X.X.X'
```

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 recommandations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.
Expand Down
7 changes: 6 additions & 1 deletion src/client/instant-meilisearch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../adapter'
import { createSearchContext } from '../contexts'
import { SearchCache, cacheFirstFacetDistribution } from '../cache/'
import { PACKAGE_VERSION } from '../package-version'

/**
* Instanciate SearchClient required by instantsearch.js.
Expand All @@ -31,7 +32,11 @@ export function instantMeiliSearch(
const searchResolver = SearchResolver(SearchCache())
// paginationTotalHits can be 0 as it is a valid number
let defaultFacetDistribution: any = {}
const meilisearchClient = new MeiliSearch({ host: hostUrl, apiKey: apiKey })
const meilisearchClient = new MeiliSearch({
host: hostUrl,
apiKey: apiKey,
clientAgents: [`Meilisearch instant-meilisearch (v${PACKAGE_VERSION})`],
})

return {
/**
Expand Down
1 change: 1 addition & 0 deletions src/package-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PACKAGE_VERSION = '0.7.1'