-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (39 loc) · 1.2 KB
/
xclone_cd.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
name: CD Pipeline
on:
pull_request:
branches:
- 'main'
types: [ closed ]
concurrency:
group: xclone-dev-cd
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: DockerHub Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create application.properties from secret
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_PROPERTIES }}" | base64 --decode > src/main/resources/application.properties
- name: Build and push Docker image
run: |
docker build -t kimjooyoung/xclone-backend-dev:latest .
docker push kimjooyoung/xclone-backend-dev:latest
- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
port: 22
script: |
cd /home/ubuntu/xclone
sudo ./deploy.sh