Skip to content

Commit f0a363c

Browse files
authored
merge: PR #48 from sameboat-platform/chore/release-0.1.1
This pull request introduces version bump automation scripts for easier releases, updates the project version to v0.1.1, and documents the new release in CHANGELOG.md. The changes streamline the release workflow and improve changelog clarity for the new backend wrap-up milestone.
2 parents 8aa62a1 + c6a82e6 commit f0a363c

File tree

5 files changed

+79
-4
lines changed

5 files changed

+79
-4
lines changed

CHANGELOG.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66
### Added
7+
- (placeholder)
8+
9+
### Changed
10+
- (placeholder)
11+
12+
### Fixed
13+
- (placeholder)
14+
15+
---
16+
17+
## [v0.1.1] - 2025-10-29 – Week 4 backend wrap-up
18+
### Added
719
- Password complexity validation on registration (min 8 chars, includes upper/lower/digit) with validation message.
820
- In-memory login rate limiting (5 attempts within 5 minutes by email+IP) returning HTTP 429 `RATE_LIMITED`.
921
- Scheduled session pruning job (hourly) with JPQL bulk delete; transactional execution.
@@ -15,6 +27,12 @@ All notable changes to this project will be documented in this file.
1527
- `prod`: Postgres/Neon, secure cookies (domain + `Secure=true`), explicit CORS allowlist.
1628
- CORS configuration via `CorsConfig` and Security chain `.cors()`; credentials enabled and origins restricted to configured list.
1729
- CI release job on tag push (`v*`): builds JAR and attaches it to a GitHub Release using `softprops/action-gh-release@v1`.
30+
- `ResourceNotFoundException` mapped by `GlobalExceptionHandler` to HTTP 404 with error code `NOT_FOUND`; service methods use throw-or-404 semantics for true missing cases.
31+
- Focused tests for error envelopes:
32+
- `NOT_FOUND` (404) mapping from service-thrown exception
33+
- `BAD_REQUEST` (400) mapping for `IllegalArgumentException`
34+
- Gated user read endpoint `GET /users/{id}` returning `PublicUserDto` (no email); enabled only when `sameboat.endpoints.user-read=true`. Access allowed to self or `ADMIN`.
35+
- OpenAPI spec updates: reusable `ErrorResponse` schema with current error codes; documented `/api/version` response.
1836

1937
### Changed
2038
- `README.md`: Documented password policy, `RATE_LIMITED` error code, and updated sample passwords; linked to new docs.
@@ -23,8 +41,10 @@ All notable changes to this project will be documented in this file.
2341
- `CONTRIBUTING.md`: Included `RATE_LIMITED` in error codes and noted password complexity under security.
2442
- Unified Actuator base path to `/actuator` across profiles; health and info remain exposed publicly via security rules. Legacy `/api/actuator/*` references were removed from tests/config where applicable.
2543
- Security rules clarified: public `GET /health`, `GET /actuator/health`, `GET /actuator/info`, auth endpoints `POST /api/auth/login|register|logout` (and legacy `/auth/*`) remain public; other endpoints require authentication (e.g., `GET /api/me`).
26-
- Input validation tightened on auth payloads (`@Valid` + Bean Validation). Validation errors are mapped by `GlobalExceptionHandler` to `400` with `{"error":"VALIDATION_ERROR"}`.
44+
- Input validation tightened on auth payloads (`@Valid` + Bean Validation). Validation errors are mapped by `GlobalExceptionHandler` to `400` with `{ "error":"VALIDATION_ERROR" }`.
2745
- Documentation updates for profile usage, CORS, cookies, and deployment notes (Render/Neon).
46+
- README Week 4 highlights added; error catalog includes `NOT_FOUND`; Windows `mvn` usage note for quoted properties on cmd.exe.
47+
- Logging: `AuthController.rateLimited(key)` now logs the rate limit key centrally; removed redundant branch logging.
2848

2949
### Fixed
3050
- Session pruning ClassCastException by replacing derived delete with explicit JPQL bulk delete method and using `@Transactional` in pruner.
@@ -44,8 +64,9 @@ All notable changes to this project will be documented in this file.
4464

4565

4666
---
47-
Reference: See `docs/weekly-plan/week-3/week-3-checkout-backend.md` for a narrative weekly summary.
67+
Reference: See `docs/weekly-plan/week-3/week-3-checkout-backend.md` and `docs/weekly-plan/week-4/week-4-checkout-backend.md` for narrative weekly summaries.
4868

4969

50-
[Unreleased]: https://github.com/sameboat-platform/backend/compare/v0.1.0...HEAD
70+
[Unreleased]: https://github.com/sameboat-platform/backend/compare/v0.1.1...HEAD
71+
[v0.1.1]: https://github.com/sameboat-platform/backend/releases/tag/v0.1.1
5172
[v0.1.0]: https://github.com/sameboat-platform/backend/releases/tag/v0.1.0

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>com.sameboat</groupId>
1212
<artifactId>backend</artifactId>
13-
<version>0.1.0</version>
13+
<version>0.1.1</version>
1414
<name>sameboat-backend</name>
1515
<description>sameboat-backend</description>
1616
<url/>

scripts/release-bump.cmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
setlocal ENABLEDELAYEDEXPANSION
3+
if "%~1"=="" (
4+
echo Usage: %~nx0 ^<new-version^> (e.g., 0.1.1 or 0.2.0)
5+
exit /b 1
6+
)
7+
set NEWVER=%~1
8+
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0release-bump.ps1" -NewVersion "%NEWVER%"
9+
endlocal
10+

scripts/release-bump.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string]$NewVersion
3+
)
4+
if ($NewVersion -notmatch '^\d+\.\d+\.\d+$') {
5+
Write-Error "Invalid version format. Expected: X.Y.Z"
6+
exit 1
7+
}
8+
# Update pom.xml version using Maven's built-in versioning
9+
& mvn versions:set -DnewVersion=$NewVersion -DgenerateBackupPoms=false
10+
# Update CHANGELOG compare link
11+
if (Select-String -Path CHANGELOG.md -Pattern '\[Unreleased\]:') {
12+
(Get-Content CHANGELOG.md) -replace '(\[Unreleased\]: .*compare\/)(v\d+\.\d+\.\d+)(\.\.\.HEAD)', "$1v$NewVersion$3" | Set-Content CHANGELOG.md
13+
}
14+
& git add pom.xml CHANGELOG.md
15+
& git commit -m "chore(release): v$NewVersion"
16+
if (git rev-parse "v$NewVersion" 2>$null) { Write-Error "Tag v$NewVersion already exists"; exit 1 }
17+
& git tag -a "v$NewVersion" -m "Release v$NewVersion"
18+
Write-Output "Version bumped to $NewVersion. Next: push branch + tag."
19+

scripts/release-bump.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
if [ $# -ne 1 ]; then
4+
echo "Usage: $0 <new-version> (e.g., 0.1.1 or 0.2.0)" >&2
5+
exit 1
6+
fi
7+
NEWVER="$1"
8+
# Validate semantic version format (X.Y.Z)
9+
if ! [[ "$NEWVER" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
10+
echo "Invalid version format: '$NEWVER'. Must match X.Y.Z (e.g., 1.2.3)" >&2
11+
exit 1
12+
fi
13+
# Update pom.xml version (safe: only project version)
14+
./mvnw versions:set -DnewVersion="${NEWVER}" -DgenerateBackupPoms=false
15+
# Update CHANGELOG compare link Unreleased -> new version
16+
if grep -q "\[Unreleased\]:" CHANGELOG.md; then
17+
sed -i.bak -E "s|(\[Unreleased\]: .*compare/)(v[0-9]+\.[0-9]+\.[0-9]+)(\.\.\.HEAD)|\1v${NEWVER}\3|" CHANGELOG.md || true
18+
rm -f CHANGELOG.md.bak
19+
fi
20+
# Commit and tag
21+
git add pom.xml CHANGELOG.md
22+
git commit -m "chore(release): v${NEWVER}"
23+
git tag -a "v${NEWVER}" -m "Release v${NEWVER}"
24+
echo "Version bumped to ${NEWVER}. Next: push branch + tag."
25+

0 commit comments

Comments
 (0)