-
-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (37 loc) · 1.14 KB
/
deploy.yml
File metadata and controls
40 lines (37 loc) · 1.14 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
name: Deploy to Production
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'push' &&
!contains(github.event.head_commit.message || '', '[skip ci]') &&
(github.event.head_commit.author.name || '') != 'open-paws-bot'
)
steps:
- name: Deploy to Droplet
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5
with:
host: 64.227.144.36
username: root
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
set -e
cd /opt/cryptpad
echo "[$(date)] Starting deployment..."
git config --global --add safe.directory /opt/cryptpad
git fetch origin
git reset --hard origin/main
docker compose build
docker compose down --remove-orphans --timeout 30 || true
docker rm -f cryptpad-cryptpad-1 2>/dev/null || true
docker compose up -d
echo "[$(date)] Deployment complete!"