-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrelease.sh
executable file
·41 lines (31 loc) · 1.03 KB
/
release.sh
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
#!/bin/bash
set -e
# === 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 patch --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 create --use --name koinsight-builder || 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"