[READ-ONLY] Mirror of https://github.com/mrgnw/cv.
0

Configure Feed

Select the types of activity you want to include in your feed.

cv / host-pdf-commit.sh
2.3 kB 68 lines
1#!/bin/bash 2 3# Host PDF Commit Script - runs git operations on host machine 4# This script should be run from the host, not from inside Docker 5 6set -e 7 8echo "🚀 Starting PDF generation and commit process on host..." 9 10# Get current branch 11BRANCH=$(git rev-parse --abbrev-ref HEAD) 12echo "📍 Current branch: $BRANCH" 13 14# First, regenerate PDFs using Docker (only changed ones) 15echo "📄 Generating PDFs with changes via Docker..." 16if command -v docker-compose &> /dev/null; then 17 if docker-compose ps | grep -q "app.*Up"; then 18 echo "🐳 Using existing Docker container..." 19 docker-compose exec app node pdf-cli.js --changed 20 else 21 echo "🐳 Starting Docker container..." 22 docker-compose up -d app 23 sleep 5 # Give it a moment to start 24 docker-compose exec app node pdf-cli.js --changed 25 fi 26else 27 echo "⚠️ Docker Compose not found, trying direct Docker..." 28 # Fallback for direct docker usage 29 if docker ps | grep -q "cv.*Up"; then 30 docker exec $(docker ps --filter "name=cv" --format "{{.ID}}") node pdf-cli.js --changed 31 else 32 echo "❌ No running Docker container found. Please start the development environment first." 33 exit 1 34 fi 35fi 36 37# Check if there are any changes in PDF files or cache file 38PDF_CHANGES=$(git status --porcelain static/ .pdf-cache.json | grep -E '\.(pdf|json)$' || true) 39if [[ -z "$PDF_CHANGES" ]]; then 40 echo "ℹ️ No PDF or cache changes detected, nothing to commit" 41 exit 0 42fi 43 44# Show what PDF files and cache changed 45echo "📋 PDF and cache changes detected:" 46echo "$PDF_CHANGES" | sed 's/^/ - /' 47 48# Add PDF files and cache file 49echo "➕ Adding PDF files and cache to git..." 50git add static/*.pdf static/sans/*.pdf .pdf-cache.json 2>/dev/null || true 51 52# Check if there's anything to commit after adding 53if git diff --cached --quiet; then 54 echo "ℹ️ No staged changes, nothing to commit" 55 exit 0 56fi 57 58# Commit with timestamp 59TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') 60COMMIT_MSG="Update PDFs and cache - $TIMESTAMP" 61echo "💾 Committing: $COMMIT_MSG" 62git commit -m "$COMMIT_MSG" 63 64# Push to current branch 65echo "🚀 Pushing to $BRANCH..." 66git push origin "$BRANCH" 67 68echo "✅ PDF generation, commit, and push completed successfully!"