-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.16 KB
/
deploy-api.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
# Deploys the application
on:
push:
branches: main
jobs:
deploy-api:
name: deploy-api
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - uses: docker/[email protected]
# with:
# push: true
# set: |
# *.cache-from=type=gha
# *.cache-to=type=gha,mode=max
- run: sudo apt-get install sshpass
- run: sshpass -v -p ${{ secrets.DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no docker-compose.yml root@${{ vars.DROPLET_IP }}
- run: sshpass -v -p ${{ secrets.DROPLET_PASSWORD }} scp -o StrictHostKeyChecking=no Dockerfile root@${{ vars.DROPLET_IP }}
- uses: appleboy/ssh-action@master
with:
host: ${{ vars.DROPLET_IP }}
username: root
password: ${{ secrets.DROPLET_PASSWORD }}
script: |
cd ~
export POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
docker-compose down
docker-compose pull
docker-compose up -d