diff --git a/.dockerignore b/.dockerignore
index 9b684cfb2..4d665402a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,15 +1,14 @@
-.git
-.github
-.idea
-.vscode
-.angular
+**
+!Dockerfile
+!.dockerignore
+!booklore-api/**
+!booklore-ui/**
+!packaging/docker/**
booklore-ui/node_modules
booklore-ui/dist
booklore-ui/.angular
booklore-ui/test-results
-booklore-api/build/reports
-booklore-api/build/test-results
-
-*.md
+booklore-api/build
+booklore-api/.gradle
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index b4b65005a..bdad50527 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -38,6 +38,26 @@ updates:
patterns:
- "*"
+ # Release tooling โ npm (semantic-release)
+ - package-ecosystem: "npm"
+ directory: "/tools/release"
+ schedule:
+ interval: "weekly"
+ day: "friday"
+ time: "03:00"
+ timezone: "UTC"
+ open-pull-requests-limit: 5
+ labels:
+ - "dependencies"
+ - "ci"
+ - "release"
+ commit-message:
+ prefix: "chore(deps)"
+ groups:
+ release-tooling:
+ patterns:
+ - "*"
+
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 42666b67d..7dd3daac3 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -2,9 +2,11 @@
+> **Required for `develop` and `main`.** Your PR title must use Conventional Commit format because maintainers squash-merge with the PR title and stable releases are computed from commit history. Example: `fix(reader): prevent blank pages on chapter jump`
+
**Linked Issue:** Fixes #
-> **Required.** Every PR must reference an approved issue. If no issue exists, [open one](https://github.com/booklore-app/booklore/issues/new) and wait for maintainer approval before submitting a PR. Unsolicited PRs without a linked issue will be closed.
+> **Required.** Every PR must reference an approved issue. If no issue exists, [open one](https://github.com/grimmory-tools/grimmory/issues/new) and wait for maintainer approval before submitting a PR. Unsolicited PRs without a linked issue will be closed.
## ๐ท๏ธ Type of Change
@@ -82,7 +84,7 @@ PASTE OUTPUT HERE
- [ ] PR is reasonably scoped (PRs over 1000+ changed lines will be closed, split into smaller PRs)
- [ ] No unsolicited refactors, cleanups, or "improvements" are bundled in
- [ ] Flyway migration versioning is correct _(if schema was modified)_
-- [ ] Documentation PR submitted to [booklore-docs](https://github.com/booklore-app/booklore-docs) _(if user-facing changes)_
+- [ ] Required documentation updates are included in this repo or the current Grimmory docs surface _(if user-facing changes)_
### ๐ค AI-Assisted Contributions
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
deleted file mode 100644
index 89c5a28ab..000000000
--- a/.github/release-drafter.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-name-template: 'Release v$RESOLVED_VERSION'
-tag-template: 'v$RESOLVED_VERSION'
-
-version-resolver:
- major:
- labels:
- - 'major'
- minor:
- labels:
- - 'minor'
- patch:
- labels:
- - 'patch'
- default: patch
-
-categories:
- - title: '๐ New Features'
- labels:
- - 'feature'
- - title: 'โจ Enhancements'
- labels:
- - 'enhancement'
- - title: '๐จ UI Tweaks'
- labels:
- - 'ui tweaks'
- - title: '๐ Bug Fixes'
- labels:
- - 'bug'
- - 'fix'
- - title: 'โก Performance'
- labels:
- - 'performance'
- - title: '๐ ๏ธ Refactoring & Maintenance'
- labels:
- - 'refactor'
- - 'cleanup'
- - 'chore'
- - title: '๐ฆ Dependencies'
- labels:
- - 'dependencies'
- - 'dependency'
- - 'deps'
- - title: 'โ๏ธ CI/CD'
- labels:
- - 'ci'
- - 'cd'
- - 'workflow'
- - title: '๐ Documentation'
- labels:
- - 'docs'
- - 'documentation'
- - title: '๐งช Experimental'
- labels:
- - 'exploration'
- - 'experimental'
-
-exclude-labels:
- - 'skip changelog'
-
-change-template: '- $TITLE (#$NUMBER) by @$AUTHOR'
-
-template: |
- ## ๐ What's New in v$RESOLVED_VERSION
-
- $CHANGES
-
- ## ๐ณ Docker Images
-
- - **Docker Hub:** `booklore/booklore:v$RESOLVED_VERSION`
- - **GitHub Container Registry:** `ghcr.io/booklore-app/booklore:v$RESOLVED_VERSION`
-
- **Full Changelog**: https://github.com/booklore-app/booklore/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
diff --git a/.github/workflows/ci-validate.yml b/.github/workflows/ci-validate.yml
new file mode 100644
index 000000000..1aea39264
--- /dev/null
+++ b/.github/workflows/ci-validate.yml
@@ -0,0 +1,60 @@
+name: CI - Validate
+
+on:
+ pull_request:
+ branches:
+ - develop
+ - main
+ push:
+ branches:
+ - develop
+
+jobs:
+ migration-check:
+ name: Flyway Migration Check
+ if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }}
+ uses: ./.github/workflows/migrations-check.yml
+ with:
+ base_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
+ head_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
+ checkout_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
+
+ test-suite:
+ name: Test Suite
+ if: ${{ (github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]')) && (needs.migration-check.result == 'success' || needs.migration-check.result == 'skipped') }}
+ needs: [migration-check]
+ uses: ./.github/workflows/test-suite.yml
+ with:
+ checkout_ref: ${{ github.sha }}
+
+ packaging-smoke-test:
+ name: Packaging Smoke Test
+ if: ${{ (github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]')) && needs.test-suite.result == 'success' }}
+ needs: [migration-check, test-suite]
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: read
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+
+ - name: Set Up QEMU for Multi-Arch Builds
+ uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
+
+ - name: Set Up Docker Buildx
+ uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
+
+ - name: Build Runtime Image
+ uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
+ with:
+ context: .
+ file: Dockerfile
+ platforms: linux/amd64
+ push: false
+ build-args: |
+ APP_VERSION=ci-${{ github.sha }}
+ APP_REVISION=${{ github.sha }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/.github/workflows/develop-pipeline.yml b/.github/workflows/develop-pipeline.yml
deleted file mode 100644
index a6ccc9fb3..000000000
--- a/.github/workflows/develop-pipeline.yml
+++ /dev/null
@@ -1,270 +0,0 @@
-name: Develop & PR โ Build, Test, and Container Publish
-
-on:
- push:
- branches:
- - develop
- pull_request:
- branches:
- - '**'
-
-jobs:
- migration-check:
- name: Flyway Migration Check
- uses: ./.github/workflows/migrations-check.yml
- with:
- base_ref: 'develop'
- head_ref: 'HEAD'
-
- backend-tests:
- name: Backend Tests
- needs: [ migration-check ]
- if: needs.migration-check.result == 'success' || needs.migration-check.result == 'skipped'
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- checks: write
- pull-requests: write
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
-
- - name: Set Up JDK 25
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
- with:
- java-version: '25'
- distribution: 'temurin'
- cache: gradle
-
- - name: Execute Backend Tests
- id: backend_tests
- working-directory: ./booklore-api
- run: |
- echo "Running backend tests..."
- ./gradlew test --no-daemon --parallel --build-cache
- continue-on-error: true
-
- - name: Publish Backend Test Results
- uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
- if: always()
- with:
- files: booklore-api/build/test-results/**/*.xml
- check_name: Backend Test Results
-
- - name: Upload Backend Test Reports
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- if: always()
- with:
- name: backend-test-reports
- path: |
- booklore-api/build/reports/tests/
- booklore-api/build/test-results/
- retention-days: 30
-
- - name: Validate Backend Test Results
- if: steps.backend_tests.outcome == 'failure'
- run: |
- echo "โ Backend tests failed"
- exit 1
-
- frontend-tests:
- name: Frontend Tests
- needs: [ migration-check ]
- if: needs.migration-check.result == 'success' || needs.migration-check.result == 'skipped'
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- checks: write
- pull-requests: write
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
-
- - name: Set Up Node.js
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
- with:
- node-version: '24'
- cache: 'npm'
- cache-dependency-path: booklore-ui/package-lock.json
-
- - name: Install Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm ci
-
- - name: Audit Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm audit --audit-level=high
-
- - name: Validate Dependency Tree
- working-directory: ./booklore-ui
- run: npm ls --depth=0
-
-
- - name: Execute Frontend Tests
- id: frontend_tests
- working-directory: ./booklore-ui
- run: |
- echo "Running frontend tests..."
- npx ng test
- continue-on-error: true
-
- - name: Publish Frontend Test Results
- uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
- if: always()
- with:
- files: booklore-ui/test-results/vitest-results.xml
- check_name: Frontend Test Results
-
- - name: Upload Frontend Test Reports
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- if: always()
- with:
- name: frontend-test-reports
- path: |
- booklore-ui/test-results/vitest-results.xml
- retention-days: 30
-
- - name: Validate Frontend Test Results
- if: steps.frontend_tests.outcome == 'failure'
- run: |
- echo "โ Frontend tests failed"
- exit 1
-
- build-and-push:
- name: Build and Push Container
- needs: [ backend-tests, frontend-tests ]
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- packages: write
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- with:
- fetch-depth: 0
-
- # ----------------------------------------
- # Image tagging
- # ----------------------------------------
- - name: Generate Image Tag
- id: set_image_tag
- run: |
- short_sha=$(git rev-parse --short HEAD)
-
- if [ "${{ github.event_name }}" = "pull_request" ]; then
- image_tag="pr-${{ github.event.pull_request.number }}-${short_sha}"
- else
- image_tag="develop-${short_sha}"
- fi
-
- echo "image_tag=$image_tag" >> $GITHUB_ENV
- echo "Image tag: $image_tag"
-
- # ----------------------------------------
- # Native Angular build
- # ----------------------------------------
- - name: Set Up Node.js
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
- with:
- node-version: '24'
- cache: 'npm'
- cache-dependency-path: booklore-ui/package-lock.json
-
- - name: Install Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm ci
-
- - name: Audit Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm audit --audit-level=high
-
- - name: Validate Dependency Tree
- working-directory: ./booklore-ui
- run: npm ls --depth=0
-
-
- - name: Build Angular App
- working-directory: ./booklore-ui
- run: npx ng build --configuration=production
-
- # ----------------------------------------
- # Native Gradle build
- # ----------------------------------------
- - name: Set Up JDK 25
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
- with:
- java-version: '25'
- distribution: 'temurin'
- cache: gradle
-
- - name: Copy Angular Dist to Spring Boot Resources
- run: cp -r booklore-ui/dist/booklore/browser/. booklore-api/src/main/resources/static/
-
- - name: Inject Version into application.yaml
- env:
- APP_VERSION: ${{ env.image_tag }}
- run: |
- sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_linux_amd64
- sudo chmod +x /usr/local/bin/yq
- yq eval '.app.version = strenv(APP_VERSION)' -i booklore-api/src/main/resources/application.yaml
-
- - name: Build Spring Boot JAR
- working-directory: ./booklore-api
- run: ./gradlew clean build -x test --no-daemon --parallel --build-cache
-
- # ----------------------------------------
- # Environment setup
- # ----------------------------------------
- - name: Set Up QEMU for Multi-Arch Builds
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
-
- - name: Set Up Docker Buildx
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
-
- # ----------------------------------------
- # Docker login (pushes & internal PRs only)
- # ----------------------------------------
- - name: Authenticate to Docker Hub
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
-
- - name: Authenticate to GitHub Container Registry
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ github.token }}
-
- # ----------------------------------------
- # Docker build & push (push + internal PRs)
- # ----------------------------------------
- - name: Build and push Docker image
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
- with:
- context: .
- file: Dockerfile.ci
- platforms: linux/amd64,linux/arm64
- push: true
- tags: |
- booklore/booklore:${{ env.image_tag }}
- ghcr.io/booklore-app/booklore:${{ env.image_tag }}
- build-args: |
- APP_VERSION=${{ env.image_tag }}
- APP_REVISION=${{ github.sha }}
- cache-from: |
- type=gha
- type=registry,ref=ghcr.io/booklore-app/booklore:buildcache
- cache-to: |
- type=gha,mode=max
- type=registry,ref=ghcr.io/booklore-app/booklore:buildcache,mode=max
diff --git a/.github/workflows/master-pipeline.yml b/.github/workflows/master-pipeline.yml
deleted file mode 100644
index 90ecb2293..000000000
--- a/.github/workflows/master-pipeline.yml
+++ /dev/null
@@ -1,335 +0,0 @@
-name: Master - Build, Tag, Push, and Release
-
-on:
- push:
- branches:
- - 'master'
-
-jobs:
- get-base-ref:
- name: Get Base Ref
- runs-on: ubuntu-latest
- outputs:
- base_ref: ${{ steps.get_base.outputs.base_ref }}
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- with:
- fetch-depth: 2
- - name: Get Base Ref
- id: get_base
- run: echo "base_ref=$(git rev-parse HEAD~1)" >> $GITHUB_OUTPUT
-
- migration-check:
- name: Flyway Migration Check on Master
- needs: [ get-base-ref ]
- uses: ./.github/workflows/migrations-check.yml
- with:
- base_ref: ${{ needs.get-base-ref.outputs.base_ref }}
- head_ref: ${{ github.sha }}
-
- backend-tests:
- name: Backend Tests
- needs: [ migration-check ]
- if: needs.migration-check.result == 'success' || needs.migration-check.result == 'skipped'
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- checks: write
- pull-requests: write
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
-
- - name: Set Up JDK 25
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
- with:
- java-version: '25'
- distribution: 'temurin'
- cache: gradle
-
- - name: Execute Backend Tests
- id: backend_tests
- working-directory: ./booklore-api
- run: |
- echo "Running backend tests..."
- ./gradlew test --no-daemon --parallel --build-cache
- continue-on-error: true
-
- - name: Publish Backend Test Results
- uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
- if: always()
- with:
- files: booklore-api/build/test-results/**/*.xml
- check_name: Backend Test Results
-
- - name: Upload Backend Test Reports
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- if: always()
- with:
- name: backend-test-reports
- path: |
- booklore-api/build/reports/tests/
- booklore-api/build/test-results/
- retention-days: 30
-
- - name: Validate Backend Test Results
- if: steps.backend_tests.outcome == 'failure'
- run: |
- echo "โ Backend tests failed"
- exit 1
-
- frontend-tests:
- name: Frontend Tests
- needs: [ migration-check ]
- if: needs.migration-check.result == 'success' || needs.migration-check.result == 'skipped'
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- checks: write
- pull-requests: write
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
-
- - name: Set Up Node.js
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
- with:
- node-version: '24'
- cache: 'npm'
- cache-dependency-path: booklore-ui/package-lock.json
-
- - name: Install Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm ci
-
- - name: Audit Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm audit --audit-level=high
-
- - name: Validate Dependency Tree
- working-directory: ./booklore-ui
- run: npm ls --depth=0
-
-
- - name: Execute Frontend Tests
- id: frontend_tests
- working-directory: ./booklore-ui
- run: |
- echo "Running frontend tests..."
- npx ng test
- continue-on-error: true
-
- - name: Publish Frontend Test Results
- uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2
- if: always()
- with:
- files: booklore-ui/test-results/vitest-results.xml
- check_name: Frontend Test Results
-
- - name: Upload Frontend Test Reports
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
- if: always()
- with:
- name: frontend-test-reports
- path: |
- booklore-ui/test-results/vitest-results.xml
- retention-days: 30
-
- - name: Validate Frontend Test Results
- if: steps.frontend_tests.outcome == 'failure'
- run: |
- echo "โ Frontend tests failed"
- exit 1
-
- build-and-release:
- needs: [ backend-tests, frontend-tests ]
- if: needs.backend-tests.result == 'success' && needs.frontend-tests.result == 'success'
- runs-on: ubuntu-latest
- permissions:
- contents: write
- packages: write
- pull-requests: read
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- with:
- fetch-depth: 0
-
- - name: Authenticate to Docker Hub
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
-
- - name: Authenticate to GitHub Container Registry
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ github.token }}
-
- - name: Set Up QEMU for Multi-Architecture Builds
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
-
- - name: Set Up Docker Buildx
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
-
- - name: Retrieve Latest Master Version Tag
- id: get_version
- run: |
- latest_tag=$(git tag --list "v*" --sort=-v:refname | head -n 1)
- latest_tag=${latest_tag:-"v0.0.0"}
- echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- echo "Latest master tag: $latest_tag"
-
- - name: Determine Version Bump
- id: determine_bump
- env:
- GH_TOKEN: ${{ github.token }}
- run: |
- echo "Determining version bump from PR labels..."
-
- # Extract PR number from merge commit
- pr_number=$(git log -1 --pretty=%B | grep -oE 'Merge pull request #[0-9]+' | grep -oE '[0-9]+') || true
- if [ -z "$pr_number" ]; then
- pr_number=$(gh pr list --state merged --base master --limit 1 --json number --jq '.[0].number')
- fi
- echo "PR number: $pr_number"
-
- labels=$(gh pr view "$pr_number" --json labels --jq '.labels[].name' || echo "")
- echo "PR labels: $labels"
-
- if echo "$labels" | grep -q 'bump:major'; then
- bump="major"
- elif echo "$labels" | grep -q 'bump:minor'; then
- bump="minor"
- elif echo "$labels" | grep -q 'bump:patch'; then
- bump="patch"
- else
- last_commit_msg=$(git log -1 --pretty=%B)
- if echo "$last_commit_msg" | grep -iq '#major'; then
- bump="major"
- elif echo "$last_commit_msg" | grep -iq '#minor'; then
- bump="minor"
- elif echo "$last_commit_msg" | grep -iq '#patch'; then
- bump="patch"
- else
- bump="patch"
- fi
- fi
-
- # Calculate next version
- semver=$(echo ${{ env.latest_tag }} | sed 's/^v//')
- major=$(echo $semver | cut -d. -f1)
- minor=$(echo $semver | cut -d. -f2)
- patch=$(echo $semver | cut -d. -f3)
-
- case "$bump" in
- major) major=$((major+1)); minor=0; patch=0 ;;
- minor) minor=$((minor+1)); patch=0 ;;
- patch) patch=$((patch+1)) ;;
- esac
-
- next_version="v${major}.${minor}.${patch}"
- echo "Version bump type: $bump"
- echo "Next version: $next_version"
-
- echo "bump=$bump" >> $GITHUB_ENV
- echo "new_tag=$next_version" >> $GITHUB_ENV
-
- # ----------------------------------------
- # Native Angular build
- # ----------------------------------------
- - name: Set Up Node.js
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
- with:
- node-version: '24'
- cache: 'npm'
- cache-dependency-path: booklore-ui/package-lock.json
-
- - name: Install Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm ci
-
- - name: Audit Frontend Dependencies
- working-directory: ./booklore-ui
- run: npm audit --audit-level=high
-
- - name: Validate Dependency Tree
- working-directory: ./booklore-ui
- run: npm ls --depth=0
-
-
- - name: Build Angular App
- working-directory: ./booklore-ui
- run: npx ng build --configuration=production
-
- # ----------------------------------------
- # Native Gradle build
- # ----------------------------------------
- - name: Set Up JDK 25
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
- with:
- java-version: '25'
- distribution: 'temurin'
- cache: gradle
-
- - name: Copy Angular Dist to Spring Boot Resources
- run: cp -r booklore-ui/dist/booklore/browser/. booklore-api/src/main/resources/static/
-
- - name: Inject Version into application.yaml
- env:
- APP_VERSION: ${{ env.new_tag }}
- run: |
- sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.52.2/yq_linux_amd64
- sudo chmod +x /usr/local/bin/yq
- yq eval '.app.version = strenv(APP_VERSION)' -i booklore-api/src/main/resources/application.yaml
-
- - name: Build Spring Boot JAR
- working-directory: ./booklore-api
- run: ./gradlew clean build -x test --no-daemon --parallel --build-cache
-
- # ----------------------------------------
- # Docker build & push
- # ----------------------------------------
- - name: Build and push Docker image
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
- with:
- context: .
- file: Dockerfile.ci
- platforms: linux/amd64,linux/arm64
- push: true
- tags: |
- booklore/booklore:${{ env.new_tag }}
- booklore/booklore:latest
- ghcr.io/booklore-app/booklore:${{ env.new_tag }}
- ghcr.io/booklore-app/booklore:latest
- build-args: |
- APP_VERSION=${{ env.new_tag }}
- APP_REVISION=${{ github.sha }}
- cache-from: |
- type=gha
- type=registry,ref=ghcr.io/booklore-app/booklore:buildcache
- cache-to: |
- type=gha,mode=max
- type=registry,ref=ghcr.io/booklore-app/booklore:buildcache,mode=max
-
- - name: Update GitHub Release Draft
- uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97 # v6
- with:
- tag: ${{ env.new_tag }}
- name: "Release ${{ env.new_tag }}"
- env:
- GITHUB_TOKEN: ${{ github.token }}
-
- - name: Publish GitHub Draft Release
- env:
- GITHUB_TOKEN: ${{ github.token }}
- run: |
- gh release edit ${{ env.new_tag }} --draft=true
diff --git a/.github/workflows/migrations-check.yml b/.github/workflows/migrations-check.yml
index 2e2ba4954..f4a8697a5 100644
--- a/.github/workflows/migrations-check.yml
+++ b/.github/workflows/migrations-check.yml
@@ -3,12 +3,16 @@ name: Reusable - Flyway Migration Check
on:
workflow_call:
inputs:
+ checkout_ref:
+ description: "The ref to check out before diffing migrations"
+ required: true
+ type: string
base_ref:
- description: 'The base ref for comparison'
+ description: "The base ref for comparison"
required: true
type: string
head_ref:
- description: 'The head ref for comparison'
+ description: "The head ref for comparison"
required: true
type: string
outputs:
@@ -21,28 +25,45 @@ jobs:
name: Check for DB Migrations
runs-on: ubuntu-latest
outputs:
+ base_ref: ${{ steps.normalize_refs.outputs.base_ref }}
+ head_ref: ${{ steps.normalize_refs.outputs.head_ref }}
has_migrations: ${{ steps.check_migrations.outputs.has_migrations }}
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
+ ref: ${{ inputs.checkout_ref }}
+
+ - name: Normalize Diff Refs
+ id: normalize_refs
+ run: |
+ base_ref="${{ inputs.base_ref }}"
+ head_ref="${{ inputs.head_ref }}"
+
+ if [ "$base_ref" = "0000000000000000000000000000000000000000" ]; then
+ echo "base_ref is the all-zero sentinel; callers must supply a real comparison base for migration checks." >&2
+ exit 1
+ fi
+
+ echo "base_ref=$base_ref" >> "$GITHUB_OUTPUT"
+ echo "head_ref=$head_ref" >> "$GITHUB_OUTPUT"
- name: Detect Flyway Migration Changes
id: check_migrations
run: |
- echo "Comparing ${{ inputs.base_ref }}...${{ inputs.head_ref }}"
- if git diff --name-only ${{ inputs.base_ref }}...${{ inputs.head_ref }} | grep -q "booklore-api/src/main/resources/db/migration/V.*.sql"; then
+ echo "Comparing ${{ steps.normalize_refs.outputs.base_ref }}...${{ steps.normalize_refs.outputs.head_ref }}"
+ if git diff --name-only "${{ steps.normalize_refs.outputs.base_ref }}...${{ steps.normalize_refs.outputs.head_ref }}" | grep -Eq "^booklore-api/src/main/resources/db/migration/V.*\\.sql$"; then
echo "Migration file changes detected. Proceeding with migration preview."
- echo "has_migrations=true" >> $GITHUB_OUTPUT
+ echo "has_migrations=true" >> "$GITHUB_OUTPUT"
else
echo "No migration file changes detected. Skipping migration preview."
- echo "has_migrations=false" >> $GITHUB_OUTPUT
+ echo "has_migrations=false" >> "$GITHUB_OUTPUT"
fi
flyway-migration-preview:
name: Flyway DB Migration Preview
- needs: [ check-for-migrations ]
+ needs: [check-for-migrations]
if: needs.check-for-migrations.outputs.has_migrations == 'true'
runs-on: ubuntu-latest
services:
@@ -63,15 +84,15 @@ jobs:
- name: Checkout Base Branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
- ref: ${{ inputs.base_ref }}
+ ref: ${{ needs.check-for-migrations.outputs.base_ref }}
fetch-depth: 0
- name: Apply Migrations from Base Branch
run: |
- echo "Applying migrations from base ref (${{ inputs.base_ref }})..."
+ echo "Applying migrations from base ref (${{ needs.check-for-migrations.outputs.base_ref }})..."
docker run --network host \
-v ${{ github.workspace }}:/flyway/sql \
- flyway/flyway:11.19.0-alpine \
+ flyway/flyway:12.1.0 \
-url=jdbc:mariadb://127.0.0.1:3306/booklore_test \
-user=root -password=root \
-locations=filesystem:/flyway/sql/booklore-api/src/main/resources/db/migration \
@@ -80,15 +101,15 @@ jobs:
- name: Checkout Head Branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
- ref: ${{ inputs.head_ref }}
+ ref: ${{ needs.check-for-migrations.outputs.head_ref }}
fetch-depth: 0
- name: Apply Migrations from Head Branch
run: |
- echo "Applying new migrations from head ref (${{ inputs.head_ref }})..."
+ echo "Applying new migrations from head ref (${{ needs.check-for-migrations.outputs.head_ref }})..."
docker run --network host \
-v ${{ github.workspace }}:/flyway/sql \
- flyway/flyway:11.19.0-alpine \
+ flyway/flyway:12.1.0 \
-url=jdbc:mariadb://127.0.0.1:3306/booklore_test \
-user=root -password=root \
-locations=filesystem:/flyway/sql/booklore-api/src/main/resources/db/migration \
diff --git a/.github/workflows/preview-image.yml b/.github/workflows/preview-image.yml
new file mode 100644
index 000000000..549eb5668
--- /dev/null
+++ b/.github/workflows/preview-image.yml
@@ -0,0 +1,82 @@
+name: Preview - Build Image
+
+on:
+ workflow_dispatch:
+ inputs:
+ ref:
+ description: 'Git ref to preview build'
+ required: true
+ type: string
+ pr_number:
+ description: 'Optional PR number for a pr-