Skip to content

Commit 669c0ab

Browse files
C4ptainCrunchclaude
andcommitted
Improve deploy action output and script logging
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 373d591 commit 669c0ab

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ jobs:
1212
github.event.workflow_run.conclusion == 'success'
1313
&& startsWith(github.event.workflow_run.head_branch, '20')
1414
steps:
15-
- name: Trigger deploy webhook
15+
- name: Deploy ${{ github.event.workflow_run.head_branch }}
1616
env:
1717
WEBHOOK_SECRET: ${{ secrets.DEPLOY_WEBHOOK_SECRET }}
18+
TAG: ${{ github.event.workflow_run.head_branch }}
1819
run: |
19-
TAG="${{ github.event.workflow_run.head_branch }}"
20-
REF="refs/tags/$TAG"
21-
PAYLOAD="{\"ref\":\"$REF\"}"
20+
PAYLOAD="{\"ref\":\"refs/tags/$TAG\"}"
2221
SIGNATURE="sha256=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | cut -d' ' -f2)"
2322
24-
HTTP_CODE=$(curl --max-time 120 \
23+
HTTP_CODE=$(curl -s --max-time 120 \
2524
-o /tmp/deploy-output.txt \
2625
-w "%{http_code}" \
2726
-X POST \
@@ -30,15 +29,9 @@ jobs:
3029
-d "$PAYLOAD" \
3130
"https://dochub.be/webhook/dochub-deploy")
3231
33-
echo "=== Deploy output ==="
3432
cat /tmp/deploy-output.txt
3533
3634
if [ "$HTTP_CODE" != "200" ]; then
3735
echo "Webhook returned HTTP $HTTP_CODE"
3836
exit 1
3937
fi
40-
41-
if ! grep -q "Deployed $TAG" /tmp/deploy-output.txt; then
42-
echo "Deploy did not complete successfully"
43-
exit 1
44-
fi

deploy.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,23 @@ exec 200>/tmp/dochub-deploy.lock
1414
flock -n 200 || { echo "Deploy already running, skipping" >&2; exit 1; }
1515

1616
cd /srv/dochub/source
17+
18+
PREV=$(git describe --tags HEAD 2>/dev/null || git rev-parse --short HEAD)
19+
echo "Deploying $PREV -> $TAG"
20+
echo
21+
22+
echo "[1/4] Fetching and checking out $TAG..."
1723
git fetch --tags --prune origin
1824
git checkout "$TAG"
25+
26+
echo "[2/4] Running migrations..."
1927
/srv/dochub/.local/bin/uv run manage.py migrate --noinput
28+
29+
echo "[3/4] Collecting static files..."
2030
/srv/dochub/.local/bin/uv run manage.py collectstatic --noinput
31+
32+
echo "[4/4] Restarting services..."
2133
sudo /bin/systemctl restart dochub-gunicorn dochub-celery
22-
echo "Deployed $TAG"
34+
35+
echo
36+
echo "Done. Deployed $TAG."

0 commit comments

Comments
 (0)