Skip to content

Commit e629dce

Browse files
authored
Add release automation (#212)
## Description Add a script called in the release automation workflow. Example PR: fishjam-cloud/release-test-js-server-sdk#4 ## Motivation and Context Speed up the release. ## Documentation impact - [ ] Documentation update required - [ ] Documentation updated [in another PR](_) - [ ] No documentation update required ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1 parent 47c2145 commit e629dce

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodejs 24.4.1
2+
protoc 33.0

release-automation/bump-version.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Usage: ./bump-version.sh <version>
5+
VERSION="$1"
6+
7+
if [ -z "$GH_TOKEN" ]; then
8+
echo "Error: GH_TOKEN environment variable is not set"
9+
exit 1
10+
fi
11+
12+
if [ -z "$VERSION" ]; then
13+
echo "Usage: $0 <version>"
14+
exit 1
15+
fi
16+
17+
# Install asdf dependencies if .tool-versions exists
18+
if [ -f .tool-versions ]; then
19+
echo "Installing asdf dependencies..."
20+
# add plugins from .tool-versions
21+
while read -r line; do
22+
PLUGIN_NAME=$(echo "$line" | awk '{print $1}')
23+
if ! asdf plugin list | grep -q "^$PLUGIN_NAME$"; then
24+
echo "Adding asdf plugin: $PLUGIN_NAME"
25+
asdf plugin add "$PLUGIN_NAME"
26+
else
27+
echo "asdf plugin $PLUGIN_NAME already added"
28+
fi
29+
done < .tool-versions
30+
31+
asdf install
32+
else
33+
echo ".tool-versions file not found!"
34+
exit 1
35+
fi
36+
37+
# Create release branch
38+
BRANCH_NAME="release-$VERSION"
39+
git checkout -b "$BRANCH_NAME"
40+
41+
42+
# Update root package.json
43+
if [ -f package.json ]; then
44+
echo "Enabling corepack..."
45+
corepack enable
46+
corepack yarn version "$VERSION"
47+
echo "Updated root package.json to $VERSION"
48+
else
49+
echo "Root package.json not found!"
50+
exit 1
51+
fi
52+
53+
corepack yarn workspaces foreach -A version "$VERSION"
54+
55+
56+
# Run proto generation
57+
if corepack yarn gen:proto; then
58+
echo "Protos generated."
59+
else
60+
echo "Proto generation failed!"
61+
exit 1
62+
fi
63+
64+
65+
# Run openapi codegen in fishjam-openapi
66+
cd packages/fishjam-openapi
67+
68+
curl -H "Authorization: token $GH_TOKEN" \
69+
-H "Accept: application/vnd.github.v3.raw" \
70+
-L "https://raw.githubusercontent.com/fishjam-cloud/fishjam/main/openapi.yaml" \
71+
-o openapi.yaml
72+
73+
npx @openapitools/openapi-generator-cli generate \
74+
-i ./openapi.yaml \
75+
-g typescript-axios \
76+
-o ./src/generated
77+
78+
rm openapi.yaml
79+
cd ../../
80+
81+
echo "✅ Version bump complete for $VERSION"
82+
echo "BRANCH_NAME:$BRANCH_NAME"

0 commit comments

Comments
 (0)