Skip to content

Develop

Develop #37

Workflow file for this run

name: Java CI with Gradle
on:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
CI-CD:
runs-on: ubuntu-latest
steps:
## jdk setting
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
## create application-dev.yml
- name: make application-dev.yml
run: |
cd ./src/main
mkdir resources
cd ./resources
touch ./application-dev.yml
echo "${{ secrets.YML_DEV }}" > ./application-dev.yml
shell: bash
## gradle build
- name: Build with Gradle
run: ./gradlew build -x test
## docker build & push to develop
- name: Docker build & push to dev
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/replyrecommend-dev .
docker push ${{ secrets.DOCKER_USERNAME }}/replyrecommend-dev
## deploy to develop
- name: Deploy to dev
uses: appleboy/ssh-action@master
id: deploy-dev
with:
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: 22
script: |
sudo docker rm -f $(sudo docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/replyrecommend-dev
sudo docker run -itd -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/replyrecommend-dev