-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (58 loc) · 2.28 KB
/
Copy pathdeploy-cloud.yml
File metadata and controls
68 lines (58 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Deploy Cloud
on:
workflow_dispatch:
inputs:
tag:
description: "Docker image tag to deploy (default: latest)"
required: false
default: "latest"
type: string
jobs:
deploy:
name: Deploy to Cloud Droplet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Copy config files to server
uses: appleboy/scp-action@v1.0.0
with:
host: ${{ secrets.CLOUD_HOST }}
username: root
key: ${{ secrets.CLOUD_SSH_KEY }}
source: "docker-compose.cloud.yml,deploy/cloud/Caddyfile"
target: /tmp/anythingmcp-deploy
overwrite: true
- name: Deploy via SSH
uses: appleboy/ssh-action@v1
env:
CRON_SECRET: ${{ secrets.ONBOARDING_CRON_SECRET }}
with:
host: ${{ secrets.CLOUD_HOST }}
username: root
key: ${{ secrets.CLOUD_SSH_KEY }}
envs: CRON_SECRET
script: |
set -e
cd /opt/anythingmcp-cloud
# Pull the requested tag AND refresh :latest, since
# docker-compose.cloud.yml references :latest. Without this
# the local :latest tag can point to an older image.
docker pull helpcodeai/anythingmcp:${{ inputs.tag }}
docker pull helpcodeai/anythingmcp:latest
# Update compose and Caddyfile from checkout
cp /tmp/anythingmcp-deploy/docker-compose.cloud.yml ./docker-compose.cloud.yml
cp /tmp/anythingmcp-deploy/deploy/cloud/Caddyfile ./Caddyfile
rm -rf /tmp/anythingmcp-deploy
# Keep CRON_SECRET in the server .env in sync with the repo
# secret so the onboarding-reminders cron can authenticate.
# Upsert (replace-or-append) without disturbing other vars.
touch .env
if grep -q '^CRON_SECRET=' .env; then
sed -i "s#^CRON_SECRET=.*#CRON_SECRET=${CRON_SECRET}#" .env
else
echo "CRON_SECRET=${CRON_SECRET}" >> .env
fi
# Restart services (force-recreate to pick up new image and config)
docker compose -f docker-compose.cloud.yml up -d --force-recreate --remove-orphans
docker image prune -f
echo "Deployment complete"