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
37 changes: 37 additions & 0 deletions .github/scripts/check-tag-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

# Checking if current tag matches the required formating
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
#
# Example of correct format:
# v0.1.0
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
#
# 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]*$"

if [ $? != 0 ]; then
echo "Error: Your beta tag: $current_tag is wrongly formatted."
echo 'Please refer to the contributing guide for help.'
exit 1
fi
exit 0
fi

exit 0
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ jobs:
registry-url: https://registry.npmjs.org/
- name: Check release validity
run: sh .github/scripts/check-release.sh
- name: Check tag format
run: sh .github/scripts/check-tag-format.sh "${{ github.event.release.prerelease }}"
- name: Install dependencies
run: yarn install
- name: Build instant-meilisearch
run: yarn build
- name: Publish with latest tag
if: "!github.event.release.prerelease"
if: "!github.event.release.prerelease && !contains(github.ref, 'beta')"
run: npm publish .
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish with beta tag
if: "github.event.release.prerelease"
if: "github.event.release.prerelease && contains(github.ref, 'beta')"
run: npm publish . --tag beta
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
29 changes: 19 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,25 @@ If you don't have the access to do it, please request it internally.

Here are the steps to release a beta version of this package:

- Create a new branch originating the branch containing the "beta" changes. For example, if during the Meilisearch pre-release, create a branch originating `bump-meilisearch-v*.*.*`.<br>
`vX.X.X` is the next version of the package, NOT the version of Meilisearch!

```bash
git checkout bump-meilisearch-v*.*.*
git pull origin bump-meilisearch-v*.*.*
git checkout -b vX.X.X-beta.0
```

- Change the version in `package.json` by `vX.X.X-beta.0` and commit it to the `vX.X.X-beta.0` branch
- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.

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!

```bash
git checkout bump-meilisearch-v*.*.*
git pull origin bump-meilisearch-v*.*.*
git checkout -b bump-meilisearch-v*.*.*-beta
```

- Change the version in `package.json` with `*.*.*-xxx-beta.0` and commit it to the `v*.*.*-beta` branch. None or multiple `-xxx`are valid. Examples:
- `v*.*.*-my-feature-beta.0`
- `v*.*.*-beta.0`

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

Expand Down