-
Notifications
You must be signed in to change notification settings - Fork 7
37 lines (32 loc) · 1.04 KB
/
ssh-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
name: Main
env:
APP_NAME: "Template"
PROJECT_PATH: "/home/ubuntu/template/"
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy-ssh:
runs-on: ubuntu-latest
needs: ['testing']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.AWS_PEM }}
known_hosts: 'empty'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.AWS_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -az . ${{ secrets.AWS_USER }}@${{ secrets.AWS_HOST }}:${{ env.PROJECT_PATH }}
- name: Run build in the server
uses: garygrossgarten/github-action-ssh@release
with:
command: |
cd ${{ env.PROJECT_PATH }}
docker-compose -f prod.yml -f prod.dev.yml up -d --build
host: ${{ secrets.AWS_HOST }}
username: ${{ secrets.AWS_USER }}
privateKey: ${{ secrets.AWS_PEM}}