🚀 feat(matrix-bots): add CI/CD pipeline for automated GHCR deployment

- Update 10 Matrix Bot Dockerfiles for monorepo builds with pnpm
- Add shared package support (bot-services, matrix-bot-common)
- Extend CI pipeline with change detection and build jobs
- Update docker-compose.macmini.yml to use GHCR images
- Enable Watchtower auto-updates for Matrix Bots

Bots: mana, ollama, stats, project-doc, todo, calendar, nutriphi, zitare, clock, tts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-01 13:02:09 +01:00
parent f016d5aa82
commit 45152ee954
12 changed files with 923 additions and 206 deletions

View file

@ -72,6 +72,16 @@ jobs:
nutriphi-web: ${{ steps.changes.outputs.nutriphi-web }}
skilltree-backend: ${{ steps.changes.outputs.skilltree-backend }}
skilltree-web: ${{ steps.changes.outputs.skilltree-web }}
matrix-mana-bot: ${{ steps.changes.outputs.matrix-mana-bot }}
matrix-ollama-bot: ${{ steps.changes.outputs.matrix-ollama-bot }}
matrix-stats-bot: ${{ steps.changes.outputs.matrix-stats-bot }}
matrix-project-doc-bot: ${{ steps.changes.outputs.matrix-project-doc-bot }}
matrix-todo-bot: ${{ steps.changes.outputs.matrix-todo-bot }}
matrix-calendar-bot: ${{ steps.changes.outputs.matrix-calendar-bot }}
matrix-nutriphi-bot: ${{ steps.changes.outputs.matrix-nutriphi-bot }}
matrix-zitare-bot: ${{ steps.changes.outputs.matrix-zitare-bot }}
matrix-clock-bot: ${{ steps.changes.outputs.matrix-clock-bot }}
matrix-tts-bot: ${{ steps.changes.outputs.matrix-tts-bot }}
any-changes: ${{ steps.changes.outputs.any-changes }}
steps:
- name: Checkout code
@ -108,6 +118,16 @@ jobs:
echo "nutriphi-web=true" >> $GITHUB_OUTPUT
echo "skilltree-backend=true" >> $GITHUB_OUTPUT
echo "skilltree-web=true" >> $GITHUB_OUTPUT
echo "matrix-mana-bot=true" >> $GITHUB_OUTPUT
echo "matrix-ollama-bot=true" >> $GITHUB_OUTPUT
echo "matrix-stats-bot=true" >> $GITHUB_OUTPUT
echo "matrix-project-doc-bot=true" >> $GITHUB_OUTPUT
echo "matrix-todo-bot=true" >> $GITHUB_OUTPUT
echo "matrix-calendar-bot=true" >> $GITHUB_OUTPUT
echo "matrix-nutriphi-bot=true" >> $GITHUB_OUTPUT
echo "matrix-zitare-bot=true" >> $GITHUB_OUTPUT
echo "matrix-clock-bot=true" >> $GITHUB_OUTPUT
echo "matrix-tts-bot=true" >> $GITHUB_OUTPUT
echo "any-changes=true" >> $GITHUB_OUTPUT
exit 0
fi
@ -148,6 +168,16 @@ jobs:
echo "nutriphi-web=true" >> $GITHUB_OUTPUT
echo "skilltree-backend=true" >> $GITHUB_OUTPUT
echo "skilltree-web=true" >> $GITHUB_OUTPUT
echo "matrix-mana-bot=true" >> $GITHUB_OUTPUT
echo "matrix-ollama-bot=true" >> $GITHUB_OUTPUT
echo "matrix-stats-bot=true" >> $GITHUB_OUTPUT
echo "matrix-project-doc-bot=true" >> $GITHUB_OUTPUT
echo "matrix-todo-bot=true" >> $GITHUB_OUTPUT
echo "matrix-calendar-bot=true" >> $GITHUB_OUTPUT
echo "matrix-nutriphi-bot=true" >> $GITHUB_OUTPUT
echo "matrix-zitare-bot=true" >> $GITHUB_OUTPUT
echo "matrix-clock-bot=true" >> $GITHUB_OUTPUT
echo "matrix-tts-bot=true" >> $GITHUB_OUTPUT
echo "any-changes=true" >> $GITHUB_OUTPUT
exit 0
fi
@ -162,6 +192,7 @@ jobs:
SHARED_AUTH_PATTERN="packages/shared-auth/|packages/shared-types/"
SHARED_UI_PATTERN="packages/shared-ui/|packages/shared-theme/|packages/shared-icons/|packages/shared-tailwind/|packages/shared-branding/"
SHARED_WEB_PATTERN="packages/shared-auth-ui/|packages/shared-theme-ui/|packages/shared-feedback-ui/|packages/shared-profile-ui/|packages/shared-subscription-ui/|packages/shared-splitscreen/"
SHARED_BOT_PATTERN="packages/bot-services/|packages/matrix-bot-common/"
# Function to check if any pattern matches
check_pattern() {
@ -174,10 +205,13 @@ jobs:
SHARED_UI_CHANGED=$(check_pattern "$SHARED_UI_PATTERN")
SHARED_WEB_CHANGED=$(check_pattern "$SHARED_WEB_PATTERN")
SHARED_BOT_CHANGED=$(check_pattern "$SHARED_BOT_PATTERN")
echo "Common changed: $COMMON_CHANGED"
echo "Shared auth changed: $SHARED_AUTH_CHANGED"
echo "Shared UI changed: $SHARED_UI_CHANGED"
echo "Shared web changed: $SHARED_WEB_CHANGED"
echo "Shared bot changed: $SHARED_BOT_CHANGED"
# mana-core-auth: services/mana-core-auth + packages/shared-nestjs-auth
AUTH_CHANGED=$(check_pattern "services/mana-core-auth/|packages/shared-nestjs-auth/")
@ -363,6 +397,86 @@ jobs:
echo "skilltree-web=false" >> $GITHUB_OUTPUT
fi
# matrix-mana-bot
MATRIX_MANA_BOT_CHANGED=$(check_pattern "services/matrix-mana-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_MANA_BOT_CHANGED" == "true" ]; then
echo "matrix-mana-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-mana-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-ollama-bot
MATRIX_OLLAMA_BOT_CHANGED=$(check_pattern "services/matrix-ollama-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_OLLAMA_BOT_CHANGED" == "true" ]; then
echo "matrix-ollama-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-ollama-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-stats-bot
MATRIX_STATS_BOT_CHANGED=$(check_pattern "services/matrix-stats-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_STATS_BOT_CHANGED" == "true" ]; then
echo "matrix-stats-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-stats-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-project-doc-bot
MATRIX_PROJECT_DOC_BOT_CHANGED=$(check_pattern "services/matrix-project-doc-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_PROJECT_DOC_BOT_CHANGED" == "true" ]; then
echo "matrix-project-doc-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-project-doc-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-todo-bot
MATRIX_TODO_BOT_CHANGED=$(check_pattern "services/matrix-todo-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_TODO_BOT_CHANGED" == "true" ]; then
echo "matrix-todo-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-todo-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-calendar-bot
MATRIX_CALENDAR_BOT_CHANGED=$(check_pattern "services/matrix-calendar-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_CALENDAR_BOT_CHANGED" == "true" ]; then
echo "matrix-calendar-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-calendar-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-nutriphi-bot
MATRIX_NUTRIPHI_BOT_CHANGED=$(check_pattern "services/matrix-nutriphi-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_NUTRIPHI_BOT_CHANGED" == "true" ]; then
echo "matrix-nutriphi-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-nutriphi-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-zitare-bot
MATRIX_ZITARE_BOT_CHANGED=$(check_pattern "services/matrix-zitare-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_ZITARE_BOT_CHANGED" == "true" ]; then
echo "matrix-zitare-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-zitare-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-clock-bot
MATRIX_CLOCK_BOT_CHANGED=$(check_pattern "services/matrix-clock-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_CLOCK_BOT_CHANGED" == "true" ]; then
echo "matrix-clock-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-clock-bot=false" >> $GITHUB_OUTPUT
fi
# matrix-tts-bot
MATRIX_TTS_BOT_CHANGED=$(check_pattern "services/matrix-tts-bot/")
if [ "$COMMON_CHANGED" == "true" ] || [ "$SHARED_BOT_CHANGED" == "true" ] || [ "$MATRIX_TTS_BOT_CHANGED" == "true" ]; then
echo "matrix-tts-bot=true" >> $GITHUB_OUTPUT
else
echo "matrix-tts-bot=false" >> $GITHUB_OUTPUT
fi
# Check if any service needs building
if grep -q "=true" $GITHUB_OUTPUT; then
echo "any-changes=true" >> $GITHUB_OUTPUT
@ -399,6 +513,16 @@ jobs:
echo "| nutriphi-web | ${{ steps.changes.outputs.nutriphi-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| skilltree-backend | ${{ steps.changes.outputs.skilltree-backend }} |" >> $GITHUB_STEP_SUMMARY
echo "| skilltree-web | ${{ steps.changes.outputs.skilltree-web }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-mana-bot | ${{ steps.changes.outputs.matrix-mana-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-ollama-bot | ${{ steps.changes.outputs.matrix-ollama-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-stats-bot | ${{ steps.changes.outputs.matrix-stats-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-project-doc-bot | ${{ steps.changes.outputs.matrix-project-doc-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-todo-bot | ${{ steps.changes.outputs.matrix-todo-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-calendar-bot | ${{ steps.changes.outputs.matrix-calendar-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-nutriphi-bot | ${{ steps.changes.outputs.matrix-nutriphi-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-zitare-bot | ${{ steps.changes.outputs.matrix-zitare-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-clock-bot | ${{ steps.changes.outputs.matrix-clock-bot }} |" >> $GITHUB_STEP_SUMMARY
echo "| matrix-tts-bot | ${{ steps.changes.outputs.matrix-tts-bot }} |" >> $GITHUB_STEP_SUMMARY
# ===========================================
# Validation job - runs on PRs
@ -1104,3 +1228,297 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
# ===========================================
# Matrix Bots
# ===========================================
build-matrix-mana-bot:
name: Build matrix-mana-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-mana-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-mana-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-mana-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-ollama-bot:
name: Build matrix-ollama-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-ollama-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-ollama-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-ollama-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-stats-bot:
name: Build matrix-stats-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-stats-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-stats-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-stats-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-project-doc-bot:
name: Build matrix-project-doc-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-project-doc-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-project-doc-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-project-doc-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-todo-bot:
name: Build matrix-todo-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-todo-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-todo-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-todo-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-calendar-bot:
name: Build matrix-calendar-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-calendar-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-calendar-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-calendar-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-nutriphi-bot:
name: Build matrix-nutriphi-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-nutriphi-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-nutriphi-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-nutriphi-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-zitare-bot:
name: Build matrix-zitare-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-zitare-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-zitare-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-zitare-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-clock-bot:
name: Build matrix-clock-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-clock-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-clock-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-clock-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-matrix-tts-bot:
name: Build matrix-tts-bot
runs-on: ubuntu-latest
needs: detect-changes
if: needs.detect-changes.outputs.matrix-tts-bot == 'true'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/matrix-tts-bot
tags: type=raw,value=latest
- uses: docker/build-push-action@v5
with:
context: .
file: services/matrix-tts-bot/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max