Skip to content

Commit c85857c

Browse files
committed
build: update release script
1 parent 100a845 commit c85857c

File tree

2 files changed

+67
-20
lines changed

2 files changed

+67
-20
lines changed

Taskfile.yaml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,34 @@ tasks:
4444
- echo "✅ Verification complete."
4545

4646
release:
47-
desc: Release (set version, tag, bump snapshot)
47+
desc: Release project (version bump, changelog, tag, deploy)
4848
silent: true
4949
vars:
5050
VERSION: { sh: 'echo ${VERSION:-}' }
51+
MODULE: { sh: 'echo ${MODULE:-}' }
5152
cmds:
5253
- |
53-
echo "🚀 Releasing version {{.VERSION}}..."
54+
if [ -z "{{.VERSION}}" ]; then
55+
echo "❌ VERSION is required"
56+
echo "Usage:"
57+
echo " task release VERSION=0.0.22"
58+
echo " task release VERSION=0.0.22 MODULE=polyglot-core"
59+
exit 1
60+
fi
61+
62+
echo "🚀 Releasing version {{.VERSION}}"
63+
64+
if [ -n "{{.MODULE}}" ]; then
65+
echo "📦 Target module: {{.MODULE}}"
66+
else
67+
echo "📦 Target: ALL modules"
68+
fi
69+
5470
chmod +x ./scripts/release.sh
55-
./scripts/release.sh {{.VERSION}}
56-
echo "✅ Release {{.VERSION}} complete."
71+
./scripts/release.sh {{.VERSION}} {{.MODULE}}
72+
73+
echo "✅ Release {{.VERSION}} completed"
74+
5775

5876
bump:
5977
desc: Bump project version (patch|minor|major)

scripts/release.sh

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
set -euo pipefail
33

44
VERSION=${1:-}
5+
MODULE=${2:-}
6+
57
if [ -z "$VERSION" ]; then
6-
echo "❌ VERSION required: ./release.sh 1.2.3"
8+
echo "❌ VERSION required"
9+
echo "Usage:"
10+
echo " ./scripts/release.sh 0.0.22"
11+
echo " ./scripts/release.sh 0.0.22 polyglot-core"
712
exit 1
813
fi
914

@@ -17,33 +22,57 @@ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
1722
exit 0
1823
fi
1924

20-
MAVEN_OPTS="--enable-native-access=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED"
25+
export MAVEN_OPTS="--enable-native-access=ALL-UNNAMED \
26+
--add-opens=java.base/java.lang=ALL-UNNAMED"
27+
28+
echo "🔧 Setting version $VERSION for all modules"
29+
30+
./mvnw -q -ntp -B versions:set \
31+
-DnewVersion="$VERSION" \
32+
-DprocessAllModules=true \
33+
-DgenerateBackupPoms=false
2134

22-
MAVEN_OPTS="$MAVEN_OPTS" ./mvnw -q -ntp -B \
23-
versions:set -DnewVersion="$VERSION" \
24-
-DgenerateBackupPoms=false -DprocessAllModules=true 2>/dev/null
35+
# ------------------------------------------------------------------
36+
# CHANGELOG
37+
# ------------------------------------------------------------------
2538

26-
# Changelog via git-cliff
2739
if [ ! -f CHANGELOG.md ]; then
28-
echo "📝 Generating initial CHANGELOG.md with git-cliff..."
40+
echo "📝 Generating initial CHANGELOG.md"
2941
git cliff --config .git-cliff.toml --output CHANGELOG.md
3042
else
31-
echo "📝 Updating CHANGELOG.md for $VERSION with git-cliff (prepend)..."
43+
echo "📝 Updating CHANGELOG.md for $VERSION"
3244
git cliff --config .git-cliff.toml \
3345
--unreleased \
3446
--tag "$VERSION" \
3547
--prepend CHANGELOG.md
3648
fi
3749

38-
# Stage POMs + changelog
39-
git add pom.xml CHANGELOG.md
40-
git add */pom.xml 2>/dev/null || true
41-
42-
git commit -m "Release $VERSION" >/dev/null 2>&1 || true
50+
# ------------------------------------------------------------------
51+
# Commit + tag
52+
# ------------------------------------------------------------------
4353

54+
git add pom.xml CHANGELOG.md */pom.xml
55+
git commit -m "Release $VERSION" || true
4456
git tag -a "v$VERSION" -m "Release $VERSION"
4557

46-
git push origin "v$VERSION" >/dev/null 2>&1
47-
git push origin main >/dev/null 2>&1
58+
git push origin main
59+
git push origin "v$VERSION"
60+
61+
# ------------------------------------------------------------------
62+
# Deploy
63+
# ------------------------------------------------------------------
64+
65+
echo "🚀 Deploy phase"
66+
67+
if [ -z "$MODULE" ]; then
68+
echo "➡️ Deploying ALL modules"
69+
./mvnw -B -ntp deploy -P release
70+
else
71+
echo "➡️ Deploying module: $MODULE"
72+
./mvnw -B -ntp deploy \
73+
-P release \
74+
-pl "$MODULE" \
75+
-am
76+
fi
4877

49-
echo "Released $VERSION (tag v$VERSION pushed)"
78+
echo "Release $VERSION completed"

0 commit comments

Comments
 (0)