-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (34 loc) · 1.09 KB
/
cicd.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
name: CI/CD using GitHub Actions & Docker
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
run: |
cd paperplane
./gradlew build -x test
- name: Docker Build & Push
run: |
cd paperplane
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/paperplane:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/paperplane:latest
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
chmod +x /home/ubuntu/api/2024_DANPOONG_TEAM_54_BE/deploy.sh
/home/ubuntu/api/2024_DANPOONG_TEAM_54_BE/deploy.sh