chore(ci): rebrand and streamline the release pipeline (#66)

* chore(ci): rebrand and streamline the release pipeline

- CI/CD:
  - replace the old `develop`/`master` pipelines with explicit validation, nightly, preview, and release workflows
  - switch stable releases to `main`, keep `develop` for nightly builds, and make preview image builds manual-only
  - update the reusable migration check so callers pass explicit refs and validation works correctly across PRs, pushes, and release flows

- Packaging:
  - consolidate container packaging onto the root `Dockerfile` and remove `Dockerfile.ci`
  - stop mutating tracked source files during image builds by building frontend and backend assets inside the container pipeline
  - remove vendored `unrar` binaries and build the upstream CLI from source during the image build
  - keep runtime compatibility for existing Booklore deployments by preserving env vars, ports, mount paths, and legacy internal user defaults

- Deploy Surface:
  - move deployment examples under `deploy/` and Docker runtime assets under `packaging/docker`
  - rebrand image, chart, and helper-script references from Booklore to Grimmory on the build and release surfaces only
  - update Compose, Helm, and Podman examples to reflect Grimmory image names and the stable/nightly tag model

- Docs:
  - add the implementation plan under `docs/plans/ci-cd-rebrand-main-nightly.md`
  - refresh README, contributing guidance, PR template, and operational docs to match the new branch, image, and upgrade story
  - document the Booklore-to-Grimmory image swap path so existing self-hosted installs can upgrade by changing only the image reference

- Validation:
  - pass `git diff --check`
  - parse all workflow YAML successfully
  - pass `shellcheck` on the touched shell scripts

* fix(ci): address review feedback and dedupe test workflows

- Workflows:
  - extract backend and frontend test execution into a shared reusable workflow used by validation, nightly, and release pipelines
  - simplify migration ref handling, sanitize manual preview PR inputs, reduce preview cache writes, and update Flyway to the current image tag
  - remove unnecessary duplicated job definitions so the test path has one source of truth

- Packaging:
  - verify the downloaded UnRAR source tarball with SHA256 before extraction
  - remove the unnecessary forced npm install path from the production Docker build
  - harden container startup by failing clearly when APP_USER collides with an unexpected UID or GID

- Versioning and deploy docs:
  - keep app version metadata embedded in the built image instead of asking operators to set APP_VERSION in deploy examples
  - update runtime release links and support links to the Grimmory repository
  - add the Quadlet install section and finish the remaining review-targeted doc fixes and branding cleanup

- Validation:
  - pass git diff --check
  - pass shellcheck on packaging/docker/entrypoint.sh
  - parse all GitHub workflow YAML successfully

* fix: Resolve flyway version

* fix: Resolve some noise in readme

* feat(release): migrate stable releases to semantic-release

- Release automation:
  - replace the manual stable bump flow and Release Drafter with semantic-release on `main`
  - split stable delivery into a semantic-release workflow that computes version, changelog, tag, and draft GitHub release plus a tag-driven workflow that publishes container images
  - add a maintainer-run dry-run workflow to preview the next stable version and release notes before publishing

- Release tooling:
  - add a dedicated `tools/release` package with semantic-release configuration and lockfile
  - encode Grimmory's release policy so `feat` triggers minor releases, `fix`/`perf`/`refactor` trigger patch releases, and `docs`/`ci`/`build`/`chore`/`test`/`style` are changelog-only
  - maintain a committed `CHANGELOG.md` and draft GitHub releases from the same release notes source

- Contributor workflow:
  - enforce conventional PR titles for PRs targeting `develop` and `main`
  - document that feature work is squash-merged into `develop` and that stable releases are computed from the preserved conventional commit history promoted to `main`
  - update README, contributing guidance, and the PR template to match the new release process

- Bootstrap:
  - add the semantic-release migration plan under `docs/plans/semantic-release-migration.md`
  - seed the local release baseline with `v2.2.1` on commit `384512534fe5a2f42d8482a0646337e28ef54e52`
  - configure the stable image publish workflow to ignore the bootstrap tag so the first semantic-release-managed release can be `v2.2.2`

- Validation:
  - pass `git diff --check`
  - parse all workflow YAML successfully
  - verify the semantic-release config loads correctly
  - verify the local bootstrap tag is present as `v2.2.1`

* Add proper concurrency to prevent version collisions

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Tighten the release preview gate to ensure commits are present in origin/head

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix(ci): fail migration checks on missing diff base

- Migration checks:
  - remove the implicit fallback that rewrote an all-zero base ref to `head^`
  - fail fast when callers provide the all-zero sentinel instead of a real comparison base so multi-commit pushes and root-history cases do not silently skip migration files

- Validation:
  - pass `git diff --check`
  - parse `.github/workflows/migrations-check.yml` successfully

* fix(packaging): source unrar from linuxserver layer

- Container packaging:
  - replace the custom UnRAR source build stage with the published `linuxserver/unrar` image layer
  - copy the provided `/usr/bin/unrar-alpine` binary into the final runtime image as `/usr/local/bin/unrar`
  - remove the checksum, tarball, and local compile path from the Dockerfile

- Validation:
  - pass `git diff --check`

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
James Cox
2026-03-19 18:46:54 -05:00
committed by GitHub
co-authored by coderabbitai[bot]
parent 6b0c4aa66c
commit 1bc45da013
59 changed files with 7445 additions and 1061 deletions
+20
View File
@@ -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: "/"
+4 -2
View File
@@ -2,9 +2,11 @@
<!-- Why is this change needed? Explain in your own words. -->
> **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 #<!-- issue number -->
> **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
-72
View File
@@ -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
+60
View File
@@ -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
-270
View File
@@ -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
-335
View File
@@ -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
+34 -13
View File
@@ -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 \
+82
View File
@@ -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-<number>-<sha> tag'
required: false
default: ''
type: string
jobs:
build-and-push:
name: Build and Push Preview Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ inputs.ref }}
- name: Generate Preview Tag
env:
PR_NUMBER: ${{ inputs.pr_number }}
run: |
short_sha=$(git rev-parse --short HEAD)
if [ -n "$PR_NUMBER" ]; then
case "$PR_NUMBER" in
(*[!0-9]*)
echo "Invalid PR number: $PR_NUMBER"
exit 1
;;
esac
preview_tag="pr-${PR_NUMBER}-${short_sha}"
else
preview_tag="preview-${short_sha}"
fi
echo "preview_tag=$preview_tag" >> "$GITHUB_ENV"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "Preview tag: $preview_tag"
- 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: Authenticate to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push Preview image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/grimmory-tools/grimmory:${{ env.preview_tag }}
build-args: |
APP_VERSION=${{ env.preview_tag }}
APP_REVISION=${{ env.commit_sha }}
cache-from: |
type=gha
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache
cache-to: type=gha,mode=max
+99
View File
@@ -0,0 +1,99 @@
name: Nightly - Build and Publish
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
resolve_ref:
name: Resolve Nightly Ref
runs-on: ubuntu-latest
outputs:
commit_sha: ${{ steps.resolve.outputs.commit_sha }}
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: develop
- name: Record Resolved Commit
id: resolve
run: |
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
test-suite:
name: Test Suite
needs: [resolve_ref]
uses: ./.github/workflows/test-suite.yml
with:
checkout_ref: ${{ needs.resolve_ref.outputs.commit_sha }}
build-and-push:
name: Build and Push Nightly Image
needs: [resolve_ref, test-suite]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ needs.resolve_ref.outputs.commit_sha }}
- name: Generate Nightly Tag
run: |
short_sha=$(git rev-parse --short HEAD)
build_date=$(date -u +%Y%m%d)
nightly_tag="nightly-${build_date}-${short_sha}"
echo "nightly_tag=$nightly_tag" >> "$GITHUB_ENV"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "Nightly tag: $nightly_tag"
- 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: 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: Build and push Docker image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
grimmory/grimmory:${{ env.nightly_tag }}
grimmory/grimmory:nightly
ghcr.io/grimmory-tools/grimmory:${{ env.nightly_tag }}
ghcr.io/grimmory-tools/grimmory:nightly
build-args: |
APP_VERSION=${{ env.nightly_tag }}
APP_REVISION=${{ env.commit_sha }}
cache-from: |
type=gha
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache
cache-to: |
type=gha,mode=max
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache,mode=max
+76
View File
@@ -0,0 +1,76 @@
name: Release - Publish Stable Images
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
name: Build, Publish, and Finalize Stable Release
if: ${{ github.ref_name != 'v2.2.1' }}
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Record Release Tag and Commit
run: |
echo "release_tag=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "Stable release tag: ${GITHUB_REF_NAME}"
- 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: 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: Build and push Stable image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
grimmory/grimmory:${{ env.release_tag }}
grimmory/grimmory:latest
ghcr.io/grimmory-tools/grimmory:${{ env.release_tag }}
ghcr.io/grimmory-tools/grimmory:latest
build-args: |
APP_VERSION=${{ env.release_tag }}
APP_REVISION=${{ env.commit_sha }}
cache-from: |
type=gha
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache
cache-to: |
type=gha,mode=max
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache,mode=max
- name: Publish Draft GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release edit "${{ env.release_tag }}" --draft=false
+72
View File
@@ -0,0 +1,72 @@
name: Release - Semantic Stable
on:
push:
branches:
- main
concurrency:
group: release-main
cancel-in-progress: false
jobs:
migration-check:
name: Flyway Migration Check
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
uses: ./.github/workflows/migrations-check.yml
with:
base_ref: ${{ github.event.before }}
head_ref: ${{ github.sha }}
checkout_ref: ${{ github.sha }}
test-suite:
name: Test Suite
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
needs: [migration-check]
uses: ./.github/workflows/test-suite.yml
with:
checkout_ref: ${{ github.sha }}
semantic-release:
name: Compute Release, Update Changelog, and Draft GitHub Release
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
needs: [migration-check, test-suite]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set Up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tools/release/package-lock.json
- name: Install Release Tooling Dependencies
run: npm --prefix tools/release ci
- name: Configure Release Bot Git Identity
env:
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${RELEASE_GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
- name: Run semantic-release
env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: npx --prefix tools/release semantic-release --extends ./tools/release/release.config.cjs
+59
View File
@@ -0,0 +1,59 @@
name: Release - Dry Run Preview
on:
workflow_dispatch:
inputs:
ref:
description: 'Ref or commit to preview as the next stable release candidate'
required: false
default: main
type: string
jobs:
preview:
name: Preview Next Stable Release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ inputs.ref }}
- name: Confirm Preview Ref Is Contained By Main
run: |
git fetch origin main --tags --force
if ! git merge-base --is-ancestor HEAD origin/main; then
echo "Selected ref is not contained by origin/main"
exit 1
fi
git checkout -B main "$(git rev-parse HEAD)"
- name: Set Up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tools/release/package-lock.json
- name: Install Release Tooling Dependencies
run: npm --prefix tools/release ci
- name: Run semantic-release Dry Run
env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
run: |
npx --prefix tools/release semantic-release \
--dry-run \
--extends ./tools/release/release.config.cjs | tee semantic-release-preview.log
- name: Upload Preview Output
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: semantic-release-preview
path: semantic-release-preview.log
retention-days: 14
+32
View File
@@ -0,0 +1,32 @@
name: CI - Semantic PR Title
on:
pull_request:
branches:
- develop
- main
types:
- opened
- edited
- reopened
- synchronize
jobs:
validate-pr-title:
name: Validate PR Title
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check Conventional PR Title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
regex='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([A-Za-z0-9._/-]+\))?(!)?: .+$'
if ! printf '%s\n' "$PR_TITLE" | grep -Eq "$regex"; then
echo "PR titles for develop/main must use Conventional Commit format." >&2
echo "Example: refactor(release): adopt semantic-release for stable builds" >&2
exit 1
fi
+127
View File
@@ -0,0 +1,127 @@
name: Reusable - Test Suite
on:
workflow_call:
inputs:
checkout_ref:
description: 'The ref to check out before running tests'
required: true
type: string
jobs:
backend-tests:
name: Backend Tests
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ inputs.checkout_ref }}
- 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
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ inputs.checkout_ref }}
- 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=critical
- 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