Skip to content

Commit 02c874b

Browse files
saghulrkd77
authored andcommitted
Add update-version.sh script
So we don't forget to bump the version everywhere.
1 parent a0cd3a1 commit 02c874b

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

update-version.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ $# -ne 1 ]; then
6+
echo "Usage: $0 <major.minor.patch>"
7+
exit 1
8+
fi
9+
10+
VERSION="$1"
11+
MAJOR=$(echo "$VERSION" | cut -d. -f1)
12+
MINOR=$(echo "$VERSION" | cut -d. -f2)
13+
PATCH=$(echo "$VERSION" | cut -d. -f3)
14+
15+
if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then
16+
echo "Error: version must be in major.minor.patch format"
17+
exit 1
18+
fi
19+
20+
sed -i.bak \
21+
-e "s/^#define QJS_VERSION_MAJOR .*/#define QJS_VERSION_MAJOR $MAJOR/" \
22+
-e "s/^#define QJS_VERSION_MINOR .*/#define QJS_VERSION_MINOR $MINOR/" \
23+
-e "s/^#define QJS_VERSION_PATCH .*/#define QJS_VERSION_PATCH $PATCH/" \
24+
quickjs.h
25+
26+
sed -i.bak \
27+
-e "s/^ version: '.*'/ version: '$VERSION'/" \
28+
meson.build
29+
30+
rm -f quickjs.h.bak meson.build.bak
31+
32+
echo "Version updated to $VERSION"

0 commit comments

Comments
 (0)