Skip to content

Commit ee367bd

Browse files
authored
chore: Move to semantic-release (#120)
1 parent 2352f3b commit ee367bd

File tree

5 files changed

+9985
-3763
lines changed

5 files changed

+9985
-3763
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [22]
15+
elasticsearch-version: ['8.15.0', '9.0.0']
16+
17+
name: Node ${{ matrix.node-version }} - ES ${{ matrix.elasticsearch-version }}
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Start Elasticsearch ${{ matrix.elasticsearch-version }}
28+
run: |
29+
docker run -d \
30+
--name elasticsearch \
31+
-p 9200:9200 \
32+
-e "discovery.type=single-node" \
33+
-e "xpack.security.enabled=false" \
34+
-e "xpack.security.enrollment.enabled=false" \
35+
docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch-version }}
36+
37+
- name: Wait for Elasticsearch
38+
run: |
39+
echo "Waiting for Elasticsearch to be ready..."
40+
for i in {1..60}; do
41+
# Check cluster health status
42+
HEALTH=$(curl -s "http://localhost:9200/_cluster/health" 2>/dev/null || echo "")
43+
if [ ! -z "$HEALTH" ]; then
44+
STATUS=$(echo $HEALTH | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
45+
echo "Attempt $i: Cluster status is '$STATUS'"
46+
47+
# Wait for yellow or green status (yellow is ok for single-node)
48+
if [ "$STATUS" = "yellow" ] || [ "$STATUS" = "green" ]; then
49+
echo "Elasticsearch is ready!"
50+
# Give it a bit more time to fully stabilize
51+
sleep 5
52+
curl -s "http://localhost:9200/_cluster/health?pretty"
53+
break
54+
fi
55+
else
56+
echo "Attempt $i: Elasticsearch not responding yet..."
57+
fi
58+
59+
if [ $i -eq 60 ]; then
60+
echo "ERROR: Elasticsearch failed to become ready after 5 minutes"
61+
docker logs elasticsearch
62+
exit 1
63+
fi
64+
65+
sleep 5
66+
done
67+
68+
- name: Install dependencies
69+
run: npm ci
70+
71+
- name: Build
72+
run: npm run build
73+
74+
- name: Run tests
75+
run: |
76+
ES_VERSION=${{ matrix.elasticsearch-version }} \
77+
ELASTICSEARCH_URL=http://localhost:9200 \
78+
npm run mocha
79+
80+
release:
81+
needs: test
82+
runs-on: ubuntu-latest
83+
if: github.ref == 'refs/heads/main'
84+
85+
steps:
86+
- uses: actions/checkout@v3
87+
with:
88+
fetch-depth: 0
89+
persist-credentials: false
90+
91+
- name: Use Node.js
92+
uses: actions/setup-node@v3
93+
with:
94+
node-version: 22
95+
96+
- name: Install dependencies
97+
run: npm ci
98+
99+
- name: Build
100+
run: npm run build
101+
102+
- name: Release
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
106+
run: npx semantic-release

.releaserc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"@semantic-release/changelog",
7+
"@semantic-release/npm",
8+
"@semantic-release/github",
9+
[
10+
"@semantic-release/git",
11+
{
12+
"assets": ["CHANGELOG.md", "package.json"],
13+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
14+
}
15+
]
16+
]
17+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ npm install feathers-elasticsearch @elastic/elasticsearch --save
2424
**Requirements:**
2525
- Feathers v5+
2626
- Elasticsearch 8.x or 9.x (5.x, 6.x, 7.x also supported)
27-
- Node.js 18+
27+
- Node.js 20+
2828

2929
## Quick Start
3030

0 commit comments

Comments
 (0)