-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 1.45 KB
/
deploy.yml
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
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy services
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
run: |
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
cd ~/etips
docker image prune -af
git pull origin main
sops -d vars.env > .env
sudo docker compose pull
sudo docker compose build etips
sudo docker compose up -d
EOF
# - name: Set up SSH
# uses: webfactory/ssh-agent@v0.5.3
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#
# - name: Deploy services
# env:
# SSH_USER: ${{ secrets.SSH_USER }}
# SSH_HOST: ${{ secrets.SSH_HOST }}
# run: |
# ssh -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST << 'EOF'
# cd ~/etips
# git pull origin main
# sops -d vars.env > .env
# docker-compose pull
# docker-compose up -d --build
# EOF