-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (39 loc) · 1.35 KB
/
main.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
name: Deploy Gaming Donation Website
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH into Remote Server and Deploy
uses: fifsky/ssh-action@master
with:
command: |
cd /root/donations/gaming-donation
docker-compose down
export STRIPE_SK=${{ secrets.STRIPE_SK }}
export STRIPE_WHSEC=${{ secrets.STRIPE_WHSEC }}
export EMAILJS_KEY=${{ secrets.EMAILJS_KEY }}
git pull
GIT_PULL_EXIT_CODE=$?
if [ $GIT_PULL_EXIT_CODE -eq 0 ]; then
echo "Git pull successful. Updating and restarting Docker Compose."
docker-compose pull
docker-compose up -d
elif [ $GIT_PULL_EXIT_CODE -eq 1 ]; then
echo "Git pull resulted in conflicts. Resolve conflicts and push changes."
git stash
git pull
docker-compose pull
docker-compose up -d
else
echo "Git pull failed. Check repository and credentials."
exit 1
fi
host: ${{ secrets.REMOTE_HOST }}
user: ${{ secrets.REMOTE_USER }}
pass: ${{ secrets.REMOTE_PASSWORD}}