Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52d7118c33 | ||
|
|
d7631ec671 |
@@ -8,8 +8,6 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build, push, and deploy to staging
|
- name: Build, push, and deploy to staging
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
||||||
<title>Golf Card Game</title>
|
<title>Golf Card Game</title>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="golfball-logo.svg">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
42
scripts/deploy-prod.sh
Executable file
42
scripts/deploy-prod.sh
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TAG="${1:?Usage: deploy-prod.sh <tag> (e.g. v3.3.2)}"
|
||||||
|
DROPLET="root@165.245.152.51"
|
||||||
|
IMAGE="git.adlee.work/alee/golfgame"
|
||||||
|
|
||||||
|
echo "Deploying $TAG to production ($DROPLET)..."
|
||||||
|
|
||||||
|
ssh $DROPLET bash -s "$TAG" "$IMAGE" <<'REMOTE'
|
||||||
|
set -e
|
||||||
|
TAG="$1"
|
||||||
|
IMAGE="$2"
|
||||||
|
|
||||||
|
cd /opt/golfgame
|
||||||
|
|
||||||
|
# Pull the image that passed staging
|
||||||
|
docker pull "$IMAGE:$TAG"
|
||||||
|
docker tag "$IMAGE:$TAG" golfgame-app:latest
|
||||||
|
|
||||||
|
# Update code for compose/env changes
|
||||||
|
git fetch origin
|
||||||
|
git checkout "$TAG"
|
||||||
|
|
||||||
|
# Restart app
|
||||||
|
docker compose -f docker-compose.prod.yml up -d app
|
||||||
|
|
||||||
|
# Wait for healthy
|
||||||
|
echo "Waiting for health check..."
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
if docker compose -f docker-compose.prod.yml ps app | grep -q "healthy"; then
|
||||||
|
echo "Production deploy successful — $TAG"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "CRITICAL: app not healthy after 60s"
|
||||||
|
docker compose -f docker-compose.prod.yml logs --tail=30 app
|
||||||
|
exit 1
|
||||||
|
REMOTE
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
Reference in New Issue
Block a user