Skip to content

Commit 3997d38

Browse files
feat(release): add version management automation and documentation
1 parent d4f9030 commit 3997d38

3 files changed

Lines changed: 534 additions & 3 deletions

File tree

docs/guides/release-and-deployment-guide.md

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,48 @@ Create a release when:
109109
- ❌ Failed deployments
110110
- ❌ Minor bug fixes (use patch versions)
111111

112+
### How Version Display Works
113+
114+
The application displays version information in the bottom-right corner:
115+
- **Version:** From `package.json` → injected at build time → displayed as `v1.0.0`
116+
- **Build Time:** Timestamp when Docker image was built
117+
- **Commit SHA:** Git commit hash (first 7 characters)
118+
119+
**Flow:**
120+
```
121+
package.json version → CI/CD extracts → Docker build arg → Next.js env var → App displays
122+
```
123+
124+
**Example:**
125+
```json
126+
// package.json
127+
{
128+
"version": "1.0.0"
129+
}
130+
```
131+
132+
↓ CI/CD workflow extracts ↓
133+
134+
```yaml
135+
# .github/workflows/ci-cd.yml
136+
VERSION=$(node -p "require('./package.json').version")
137+
docker build --build-arg NEXT_PUBLIC_APP_VERSION=$VERSION
138+
```
139+
140+
↓ Dockerfile sets env var ↓
141+
142+
```dockerfile
143+
ARG NEXT_PUBLIC_APP_VERSION=1.0.0
144+
ENV NEXT_PUBLIC_APP_VERSION=$NEXT_PUBLIC_APP_VERSION
145+
```
146+
147+
↓ App reads at runtime ↓
148+
149+
```tsx
150+
// src/app/page.tsx
151+
const version = process.env.NEXT_PUBLIC_APP_VERSION || '1.0.0';
152+
```
153+
112154
### Release Process
113155

114156
#### Step 1: Determine Version Number
@@ -125,10 +167,37 @@ v1.0.1 - Hotfix on v1.0.0 (patch version bump)
125167
v2.0.0 - Breaking changes (major version bump)
126168
```
127169

128-
#### Step 2: Create Git Tag
170+
#### Step 2: Use the Release Script (Recommended)
171+
172+
We provide a helper script that automates the version bump, commit, and tag creation:
173+
174+
```bash
175+
# Run the release script with the version number (without 'v' prefix)
176+
./scripts/create-release.sh 1.0.0
177+
```
178+
179+
This script will:
180+
1. ✅ Validate version format (semantic versioning)
181+
2. ✅ Update `package.json` version to `1.0.0`
182+
3. ✅ Update `package-lock.json` automatically
183+
4. ✅ Commit the version bump with message `chore: bump version to 1.0.0`
184+
5. ✅ Create annotated git tag `v1.0.0`
185+
6. ✅ Push both the commit and tag to GitHub
186+
7. ✅ Display next steps for creating the GitHub Release
187+
188+
**OR Manual Process:**
189+
190+
If you prefer to do it manually:
129191

130192
```bash
131-
# Create annotated tag with detailed message
193+
# Step 1: Update package.json version
194+
npm version 1.0.0 --no-git-tag-version
195+
196+
# Step 2: Commit version bump
197+
git add package.json package-lock.json
198+
git commit -m "chore: bump version to 1.0.0"
199+
200+
# Step 3: Create annotated tag with detailed message
132201
git tag -a v1.0.0 -m "Release v1.0.0 - Infrastructure & CI/CD Complete
133202
134203
Epic 1 Complete: DevOps & CI/CD Foundation
@@ -169,10 +238,13 @@ Epic 1 Complete: DevOps & CI/CD Foundation
169238
- Registry: Artifact Registry
170239
- Container Size: ~150-200MB (Alpine-based)"
171240

172-
# Push tag to GitHub
241+
# Step 4: Push commit and tag to GitHub
242+
git push origin main
173243
git push origin v1.0.0
174244
```
175245

246+
**Important:** The version in `package.json` MUST match the git tag version for the app to display correctly.
247+
176248
#### Step 3: Create GitHub Release
177249

178250
**Option A: Via GitHub UI (Recommended)**

0 commit comments

Comments
 (0)