Commit 08f6d4c 1 parent f1eab8d commit 08f6d4c Copy full SHA for 08f6d4c
File tree 1 file changed +22
-11
lines changed
1 file changed +22
-11
lines changed Original file line number Diff line number Diff line change 4
4
push :
5
5
branches :
6
6
- main
7
+ pull_request :
7
8
8
9
jobs :
9
- build :
10
+ build-test :
10
11
runs-on : ubuntu-latest
11
12
12
13
steps :
24
25
- name : Run build
25
26
run : npm run build
26
27
28
+ - name : Run tests
29
+ run : npm test
30
+
31
+ deploy :
32
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
33
+ needs : build-test
34
+ runs-on : ubuntu-latest
35
+
36
+ steps :
37
+ - name : Checkout repository
38
+ uses : actions/checkout@v2
39
+
27
40
- name : Docker login
28
41
env :
29
42
DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
@@ -36,20 +49,18 @@ jobs:
36
49
- name : Push Docker image
37
50
run : docker push sahilyeole/portfolio:latest
38
51
39
- deploy :
40
- needs : build
41
- runs-on : ubuntu-latest
52
+ - name : Start ssh-agent
53
+ uses : webfactory/ssh-agent@v0.5.4
54
+ with :
55
+ ssh-private-key : ${{ secrets.SSH_KEY }}
56
+ ssh-passphrase : ${{ secrets.SSH_PASSPHRASE }}
42
57
43
- steps :
44
58
- name : Deploy to server via SSH
45
- uses : appleboy/ssh-action@master
46
- with :
47
- host : ${{ secrets.SSH_HOST }}
48
- username : ${{ secrets.SSH_USERNAME }}
49
- key : ${{ secrets.SSH_KEY }}
50
- script : |
59
+ run : |
60
+ ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF'
51
61
docker pull sahilyeole/portfolio:latest
52
62
docker stop portfolio-container || true
53
63
docker rm portfolio-container || true
54
64
docker run -d --name portfolio-container -p 80:3000 sahilyeole/portfolio:latest
65
+ EOF
55
66
You can’t perform that action at this time.
0 commit comments