Skip to content

Commit 54d7241

Browse files
committed
Create new publish CI for beta versions
1 parent e69368f commit 54d7241

File tree

3 files changed

+60
-12
lines changed

3 files changed

+60
-12
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
# Checking if current tag matches the required formating
4+
is_pre_release=$1
5+
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
6+
7+
if [ $is_pre_release = false ]; then
8+
# Works with the format vX.X.X
9+
#
10+
# Example of correct format:
11+
# v0.1.0
12+
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*$"
13+
if [ $? != 0 ]; then
14+
echo "Error: Your tag: $current_tag is wrongly formatted."
15+
echo 'Please refer to the contributing guide for help.'
16+
exit 1
17+
fi
18+
exit 0
19+
elif [ $is_pre_release = true ]; then
20+
# Works with the format vX.X.X-xxx-beta.X
21+
# none or multiple -xxx are valid
22+
#
23+
# 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]*$"
28+
29+
if [ $? != 0 ]; then
30+
echo "Error: Your beta tag: $current_tag is wrongly formatted."
31+
echo 'Please refer to the contributing guide for help.'
32+
exit 1
33+
fi
34+
exit 0
35+
fi
36+
37+
exit 0

.github/workflows/publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ jobs:
1414
registry-url: https://registry.npmjs.org/
1515
- name: Check release validity
1616
run: sh .github/scripts/check-release.sh
17+
- name: Check tag format
18+
run: sh .github/scripts/check-tag-format.sh "${{ github.event.release.prerelease }}"
1719
- name: Install dependencies
1820
run: yarn install
1921
- name: Build instant-meilisearch
2022
run: yarn build
2123
- name: Publish with latest tag
22-
if: "!github.event.release.prerelease"
24+
if: "!github.event.release.prerelease && !contains(github.ref, 'beta')"
2325
run: npm publish .
2426
env:
2527
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2628
- name: Publish with beta tag
27-
if: "github.event.release.prerelease"
29+
if: "github.event.release.prerelease && contains(github.ref, 'beta')"
2830
run: npm publish . --tag beta
2931
env:
3032
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

CONTRIBUTING.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,25 @@ If you don't have the access to do it, please request it internally.
159159

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

162-
- 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>
163-
`vX.X.X` is the next version of the package, NOT the version of Meilisearch!
164-
165-
```bash
166-
git checkout bump-meilisearch-v*.*.*
167-
git pull origin bump-meilisearch-v*.*.*
168-
git checkout -b vX.X.X-beta.0
169-
```
170-
171-
- Change the version in `package.json` by `vX.X.X-beta.0` and commit it to the `vX.X.X-beta.0` branch
162+
- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.
163+
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+
172+
```bash
173+
git checkout bump-meilisearch-v*.*.*
174+
git pull origin bump-meilisearch-v*.*.*
175+
git checkout -b bump-meilisearch-v*.*.*-beta
176+
```
177+
178+
- 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:
179+
- `v*.*.*-my-feature-beta.0`
180+
- `v*.*.*-beta.0`
172181

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

0 commit comments

Comments
 (0)