Skip to content

Merge pull request #9 from Kyuwon-Choi/main #2

Merge pull request #9 from Kyuwon-Choi/main

Merge pull request #9 from Kyuwon-Choi/main #2

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'
- name: Build with Gradle
run: ./gradlew build -x test
- name: Docker Build & Push
run: |
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