File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI/CD
2+
3+ on :
4+ push :
5+ branches : [ "dev" ]
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Checkout code
12+ 13+
14+ - name : Log in to Docker Hub
15+ 16+ with :
17+ username : ${{ secrets.DOCKER_USERNAME }}
18+ password : ${{ secrets.DOCKER_PASSWORD }}
19+
20+ - name : Build and Push Docker image
21+ if : github.ref == 'refs/heads/dev'
22+ 23+ with :
24+ context : .
25+ file : ./Dockerfile
26+ push : true
27+ tags : ${{ secrets.DOCKER_USERNAME }}/${{ secrets.PROD_IMAGE_NAME }}:latest
28+ platforms : linux/amd64
29+
30+ deploy :
31+ runs-on : ubuntu-latest
32+ needs : build
33+
34+ steps :
35+ - name : SSH to Server and Deploy
36+ if : github.ref == 'refs/heads/dev'
37+ 38+ with :
39+ host : ${{ secrets.PROD_SERVER_HOST }}
40+ port : ${{ secrets.PROD_SERVER_PORT }}
41+ username : ${{ secrets.PROD_SERVER_USERNAME }}
42+ key : ${{ secrets.PROD_SERVER_KEY }}
43+ script : |
44+ cd /home/ubuntu/dasom
45+ mkdir -p ./env
46+ echo "${{ secrets.ENV }}" > ./env/prodEnv
47+ ./deploy.sh
You can’t perform that action at this time.
0 commit comments