Merge pull request #989 from booklore-app/develop

Merge develop into master for release
This commit is contained in:
Aditya Chandel
2025-08-25 16:19:56 -06:00
committed by GitHub
3 changed files with 43 additions and 43 deletions
+18 -6
View File
@@ -1,5 +1,17 @@
name-template: 'v$NEXT_PATCH_VERSION 🌟' name-template: 'v$RESOLVED_VERSION 🌟'
tag-template: 'v$NEXT_PATCH_VERSION' tag-template: 'v$RESOLVED_VERSION'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
categories: categories:
- title: '🚀 New Features' - title: '🚀 New Features'
@@ -45,13 +57,13 @@ exclude-labels:
change-template: '- $TITLE (#$NUMBER) by @$AUTHOR' change-template: '- $TITLE (#$NUMBER) by @$AUTHOR'
template: | template: |
## 🌟 What's New in v$NEXT_PATCH_VERSION ## 🌟 What's New in v$RESOLVED_VERSION
$CHANGES $CHANGES
### 🐳 Docker Images ### 🐳 Docker Images
- **Docker Hub:** `booklore/booklore:v$NEXT_PATCH_VERSION` - **Docker Hub:** `booklore/booklore:v$RESOLVED_VERSION`
- **GitHub Container Registry:** `ghcr.io/booklore-app/booklore:v$NEXT_PATCH_VERSION` - **GitHub Container Registry:** `ghcr.io/booklore-app/booklore:v$RESOLVED_VERSION`
**Full Changelog**: https://github.com/booklore-app/booklore/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION **Full Changelog**: https://github.com/booklore-app/booklore/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
+24 -37
View File
@@ -51,9 +51,7 @@ jobs:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
id: determine_bump id: determine_bump
run: | run: |
# Step 1: Check if the PR has a label (priority over commit message)
pr_number=$(gh pr list --state merged --base master --limit 1 --json number --jq '.[0].number') pr_number=$(gh pr list --state merged --base master --limit 1 --json number --jq '.[0].number')
echo "PR Number: $pr_number"
labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' || echo "") labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' || echo "")
if echo "$labels" | grep -q 'major'; then if echo "$labels" | grep -q 'major'; then
bump="major" bump="major"
@@ -62,40 +60,40 @@ jobs:
elif echo "$labels" | grep -q 'patch'; then elif echo "$labels" | grep -q 'patch'; then
bump="patch" bump="patch"
fi fi
# Step 2: If no label, fallback to commit message keywords
if [ -z "$bump" ]; then if [ -z "$bump" ]; then
last_commit_msg=$(git log -1 --pretty=%B) last_commit_msg=$(git log -1 --pretty=%B)
echo "Last commit message: $last_commit_msg"
if echo "$last_commit_msg" | grep -iq '#major'; then if echo "$last_commit_msg" | grep -iq '#major'; then
bump="major" bump="major"
gh pr edit "$pr_number" --add-label "major" || echo "Could not add major label"
elif echo "$last_commit_msg" | grep -iq '#minor'; then elif echo "$last_commit_msg" | grep -iq '#minor'; then
bump="minor" bump="minor"
gh pr edit "$pr_number" --add-label "minor" || echo "Could not add minor label"
elif echo "$last_commit_msg" | grep -iq '#patch'; then elif echo "$last_commit_msg" | grep -iq '#patch'; then
bump="patch" bump="patch"
gh pr edit "$pr_number" --add-label "patch" || echo "Could not add patch label"
else else
bump="patch" # Default to patch if no keyword or label bump="patch"
gh pr edit "$pr_number" --add-label "patch" || echo "Could not add patch label"
fi fi
fi fi
echo "bump=$bump" >> $GITHUB_ENV echo "bump=$bump" >> $GITHUB_ENV
echo "Version bump type: $bump" echo "Version bump type: $bump"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-Increment Version (Only for Master) - name: Update Release Draft (Only for Master)
if: github.ref == 'refs/heads/master'
uses: release-drafter/release-drafter@v6
id: release_drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Release Version
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
id: bump_version
run: | run: |
old_version="${{ env.latest_tag }}" new_tag="${{ steps.release_drafter.outputs.tag_name }}"
IFS='.' read -r -a parts <<< "${old_version//[!0-9.]/}"
if [ "${{ env.bump }}" = "major" ]; then
new_version="$((parts[0] + 1)).0.0"
elif [ "${{ env.bump }}" = "minor" ]; then
new_version="${parts[0]}.$((parts[1] + 1)).0"
else
new_version="${parts[0]}.${parts[1]}.$((parts[2] + 1))"
fi
new_tag="v${new_version}"
echo "new_tag=$new_tag" >> $GITHUB_ENV echo "new_tag=$new_tag" >> $GITHUB_ENV
echo "New version: $new_tag" echo "New version: $new_tag"
@@ -115,14 +113,6 @@ jobs:
echo "image_tag=$image_tag" >> $GITHUB_ENV echo "image_tag=$image_tag" >> $GITHUB_ENV
echo "Image tag: $image_tag" echo "Image tag: $image_tag"
- name: Create Git Tag (Only for Master)
if: github.ref == 'refs/heads/master'
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git tag ${{ env.new_tag }}
git push origin ${{ env.new_tag }}
- name: Build and Push Docker Image (Docker Hub & GHCR) - name: Build and Push Docker Image (Docker Hub & GHCR)
run: | run: |
docker buildx create --use docker buildx create --use
@@ -143,14 +133,14 @@ jobs:
--tag ghcr.io/booklore-app/booklore:latest \ --tag ghcr.io/booklore-app/booklore:latest \
--push . --push .
- name: Update Release Draft (Only for Master) - name: Create Git Tag (Only for Master)
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
uses: release-drafter/release-drafter@v6 run: |
with: git config --global user.name "github-actions"
tag: ${{ env.new_tag }} git config --global user.email "github-actions@github.com"
name: "Release ${{ env.new_tag }}" git tag ${{ env.new_tag }}
env: git push origin ${{ env.new_tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Draft Release (Only for Master) - name: Publish Draft Release (Only for Master)
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@@ -174,20 +164,17 @@ jobs:
fi fi
echo "Preparing Discord notification for release $NEW_TAG" echo "Preparing Discord notification for release $NEW_TAG"
# fetch release info
release_json=$(gh release view "$NEW_TAG" --json name,body,url) release_json=$(gh release view "$NEW_TAG" --json name,body,url)
release_name=$(jq -r '.name' <<< "$release_json") release_name=$(jq -r '.name' <<< "$release_json")
release_body=$(jq -r '.body' <<< "$release_json") release_body=$(jq -r '.body' <<< "$release_json")
release_url=$(jq -r '.url' <<< "$release_json") release_url=$(jq -r '.url' <<< "$release_json")
# trim body if too long
clean_body=$(echo "$release_body" | tr -d '\r') clean_body=$(echo "$release_body" | tr -d '\r')
max_length=1800 max_length=1800
if [ ${#clean_body} -gt $max_length ]; then if [ ${#clean_body} -gt $max_length ]; then
clean_body="${clean_body:0:$((max_length-12))}… [truncated]" clean_body="${clean_body:0:$((max_length-12))}… [truncated]"
fi fi
# build JSON payload
payload=$(jq -n \ payload=$(jq -n \
--arg title "New Release: $release_name" \ --arg title "New Release: $release_name" \
--arg url "$release_url" \ --arg url "$release_url" \
@@ -206,4 +193,4 @@ jobs:
echo "$payload" echo "$payload"
echo "=======================" echo "======================="
curl -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" curl -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL"
@@ -15,6 +15,7 @@ app:
server: server:
forward-headers-strategy: native forward-headers-strategy: native
port: 8080
spring: spring:
servlet: servlet: