File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 72
72
73
73
- name : Push Docker image
74
74
run : docker push ${{ secrets.DOCKER_HUB_USERNAME }}/githubactionstudy:latest
75
+
76
+ deploy :
77
+ name : Deploy to EC2
78
+ runs-on : ubuntu-latest
79
+ needs : push
80
+ steps :
81
+ - name : Checkout the repo
82
+ uses : actions/checkout@v4
83
+
84
+ - name : Deploy to EC2
85
+ uses : appleboy/ssh-action@master
86
+ with :
87
+ host : ${{ secrets.AWS_EC2_HOST }}
88
+ username : ubuntu
89
+ key : ${{ secrets.AWS_EC2_SSH_KEY }}
90
+ script : |
91
+ echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
92
+ cd /home/ubuntu
93
+ export SECRET_VALUE=${{ secrets.SECRET_VALUE}}
94
+ docker-compose down || true
95
+ docker rm -f hobbyweekly-dev || true
96
+ docker-compose pull app
97
+ docker-compose up -d
You can’t perform that action at this time.
0 commit comments