mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 14:49:23 +00:00
update hash check
This commit is contained in:
parent
7bfb135ba3
commit
1bcf4f920c
33
.github/workflows/PR-Auto-Deploy-V2.yml
vendored
33
.github/workflows/PR-Auto-Deploy-V2.yml
vendored
@ -204,17 +204,34 @@ jobs:
|
|||||||
- name: Get commit hashes for frontend and backend
|
- name: Get commit hashes for frontend and backend
|
||||||
id: commit-hashes
|
id: commit-hashes
|
||||||
run: |
|
run: |
|
||||||
# Get commit hash for frontend folder
|
# Get last commit that touched the frontend folder specifically
|
||||||
FRONTEND_HASH=$(git log -1 --format="%H" -- frontend/ || echo "no-frontend-changes")
|
FRONTEND_HASH=$(git log -1 --format="%H" -- frontend/ 2>/dev/null || echo "")
|
||||||
|
if [ -z "$FRONTEND_HASH" ]; then
|
||||||
|
# If no commits found for frontend, use a default hash
|
||||||
|
FRONTEND_HASH="no-frontend-changes"
|
||||||
|
fi
|
||||||
echo "frontend_hash=$FRONTEND_HASH" >> $GITHUB_OUTPUT
|
echo "frontend_hash=$FRONTEND_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Get commit hash for backend folder (excluding frontend)
|
# Get last commit that touched files outside frontend folder (backend changes)
|
||||||
BACKEND_HASH=$(git log -1 --format="%H" -- . ':!frontend/' || echo "no-backend-changes")
|
BACKEND_HASH=$(git log -1 --format="%H" -- . ':!frontend/' 2>/dev/null || echo "")
|
||||||
|
if [ -z "$BACKEND_HASH" ]; then
|
||||||
|
# If no commits found for backend, use a default hash
|
||||||
|
BACKEND_HASH="no-backend-changes"
|
||||||
|
fi
|
||||||
echo "backend_hash=$BACKEND_HASH" >> $GITHUB_OUTPUT
|
echo "backend_hash=$BACKEND_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Short hashes for tags
|
# Short hashes for tags (handle special cases)
|
||||||
|
if [ "$FRONTEND_HASH" = "no-frontend-changes" ]; then
|
||||||
|
echo "frontend_short=no-frontend" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
echo "frontend_short=${FRONTEND_HASH:0:8}" >> $GITHUB_OUTPUT
|
echo "frontend_short=${FRONTEND_HASH:0:8}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BACKEND_HASH" = "no-backend-changes" ]; then
|
||||||
|
echo "backend_short=no-backend" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
echo "backend_short=${BACKEND_HASH:0:8}" >> $GITHUB_OUTPUT
|
echo "backend_short=${BACKEND_HASH:0:8}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check if frontend image exists
|
- name: Check if frontend image exists
|
||||||
id: check-frontend
|
id: check-frontend
|
||||||
@ -330,6 +347,9 @@ jobs:
|
|||||||
|
|
||||||
# Clean up unused Docker resources to save space
|
# Clean up unused Docker resources to save space
|
||||||
docker system prune -af --volumes
|
docker system prune -af --volumes
|
||||||
|
|
||||||
|
# Clean up old backend/frontend images (older than 2 weeks)
|
||||||
|
docker image prune -af --filter "until=336h" --filter "label!=keep=true"
|
||||||
ENDSSH
|
ENDSSH
|
||||||
|
|
||||||
# Set port for output
|
# Set port for output
|
||||||
@ -461,6 +481,9 @@ jobs:
|
|||||||
echo "V2 PR directory not found, nothing to clean up"
|
echo "V2 PR directory not found, nothing to clean up"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Clean up old unused images (older than 2 weeks) but keep recent ones for reuse
|
||||||
|
docker image prune -af --filter "until=336h" --filter "label!=keep=true"
|
||||||
|
|
||||||
# Note: We don't remove the commit-based images since they can be reused across PRs
|
# Note: We don't remove the commit-based images since they can be reused across PRs
|
||||||
# Only remove PR-specific containers and directories
|
# Only remove PR-specific containers and directories
|
||||||
ENDSSH
|
ENDSSH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user