-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (44 loc) · 1.38 KB
/
react-push.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
name: Docker
on: [push]
jobs:
test:
runs-on: ubuntu-latest
name: Test
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
fi
deploy:
if: contains(github.repository, 'opensourceai')
name: Deploy
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy file via ssh
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "./*"
target: "/app/web/github/${{ github.repository }}/"
- name: Build and Deploy ${{ github.repository }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
overwrite: true
command_timeout: 100m
script: |
cd /app/web/github/${{ github.repository }}/
export IMAGE=${{ github.repository }}
export CONTAINER_NAME=$(echo $IMAGE | cut -d "/" -f 2)
bash ./deploy-dev.sh