Skip to content

Merge pull request #13 from Kyuwon-Choi/main #6

Merge pull request #13 from Kyuwon-Choi/main

Merge pull request #13 from Kyuwon-Choi/main #6

Workflow file for this run

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