-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·53 lines (43 loc) · 1.96 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.96 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
49
50
51
52
53
#!/bin/bash
set -e
# Role: Senior DevOps Architect & Automation Specialist
# Task: Local-First Release Automation for dbx-smith
# This script handles versioning, changelog updates, and tagging locally.
# 1. Verification
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" != "main" ]; then
echo "❌ Error: Releases must be initiated from the 'main' branch."
exit 1
fi
if [[ $(git status --short) ]]; then
echo "❌ Error: Working directory is not clean. Commit or stash your changes first."
exit 1
fi
echo "🚀 Starting Local-First Release Strategy..."
# 2. Version Calculation & Changelog Update
# We use standard-version to manage the semver bump and CHANGELOG.md
# It will also update version in package.json
echo "📊 Calculating next version and updating CHANGELOG.md..."
npx standard-version --skip.tag true --skip.commit true
# 3. Code-Level Version Synchronization
# Extract the new version from package.json
NEW_VERSION=$(node -e "console.log(require('./package.json').version)")
echo "🔄 Synchronizing version v$NEW_VERSION across codebase..."
# Update version in central constants
sed -i "s/readonly VERSION=\".*\"/readonly VERSION=\"$NEW_VERSION\"/" src/core/constants.sh
# 4. Finalize Local Commit and Tag
echo "💾 Committing version bump and creating tag v$NEW_VERSION..."
git add package.json CHANGELOG.md src/core/constants.sh .github/workflows/pipeline.yml release.sh
git commit -m "chore(release): $NEW_VERSION [skip branch ci]"
git tag -a "v$NEW_VERSION" -m "release v$NEW_VERSION"
echo "✅ Local release v$NEW_VERSION prepared successfully!"
# 5. Push to Remote
read -p "❓ Do you want to push the release to origin? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "📤 Pushing to origin..."
git push origin main "v$NEW_VERSION"
echo "🎉 Push successful! The GitHub Action will now trigger the Release UI and Docs update."
else
echo "⚠️ Release created locally but NOT pushed. Run 'git push origin main v$NEW_VERSION' when ready."
fi