-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1 KB
/
deploy.yml
File metadata and controls
42 lines (37 loc) · 1 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
name: Deploy to 7demo
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '**.md'
- '.gitignore'
workflow_dispatch: {}
concurrency:
group: deploy-main
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
- name: Deploy
env:
SSH_USER: ${{ secrets.DEPLOY_USER }}
SSH_HOST: ${{ secrets.DEPLOY_HOST }}
run: |
ssh -i ~/.ssh/deploy_key "$SSH_USER@$SSH_HOST" bash <<'EOF'
set -euo pipefail
cd /opt/oltinpay
git fetch --prune origin
git reset --hard origin/main
docker compose pull || true
docker compose up -d --build
docker image prune -f || true
EOF