forked from GeorgeSG/KoInsight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·48 lines (37 loc) · 1.18 KB
/
release.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
BUMP_TYPE=${1:-patch}
if [[ ! "$BUMP_TYPE" =~ ^(patch|minor|major|prerelease)$ ]]; then
echo "Invalid version bump type: $BUMP_TYPE"
echo "Valid types: patch, minor, major, prerelease"
exit 1
fi
# === Config ===
GHCR_USER="georgesg"
REPO_NAME="koinsight"
PACKAGE_DIRS=("apps/server" "apps/web" "packages/common")
IMAGE_NAME="ghcr.io/$GHCR_USER/$REPO_NAME"
# === Bump version using changesets or npm version ===
VERSION=$(npm version "$BUMP_TYPE" --no-git-tag-version)
# === Apply version to each package.json ===
for DIR in "${PACKAGE_DIRS[@]}"; do
jq --arg v "$VERSION" '.version = $v' "$DIR/package.json" > "$DIR/package.tmp.json" && mv "$DIR/package.tmp.json" "$DIR/package.json"
done
# === Commit version bump ===
git add .
git commit -m "chore: release $VERSION"
# === Tag and push ===
git tag "$VERSION"
git push origin master
git push origin "$VERSION"
# === Build Docker image ===
docker buildx use koinsight-builder
docker buildx inspect --bootstrap
# === Build multi-arch image and push it
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "$IMAGE_NAME:$VERSION" \
-t "$IMAGE_NAME:latest" \
--push \
.
echo "✅ Released version $VERSION"