Skip to content

Commit

Permalink
Merge pull request #6 from kusitms-28th-Meetup-E/prod-contents
Browse files Browse the repository at this point in the history
Prod contents
  • Loading branch information
eojinny authored Feb 21, 2024
2 parents 80f108f + a93bfdc commit ff16190
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/prod-contents-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle
name: ContentsService

on:
push:
Expand All @@ -25,7 +25,10 @@ jobs:
distribution: 'temurin'

- name: Clean Gradle Cache
run: ./gradlew clean
run: |
cd BE-Contents-Server
ls
./gradlew clean
- name: Make application.yml
run: |
Expand All @@ -35,13 +38,20 @@ jobs:
APPLICATION: ${{ secrets.APPLICATION_CONTENTS }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew
run: |
cd BE-Contents-Server
ls
chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build -x test
run: |
cd BE-Contents-Server
ls
./gradlew build -x test
- name: Docker build
run: |
cd BE-Contents-Server
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t app .
docker tag app ${{ secrets.DOCKER_USERNAME }}/contents:latest
Expand All @@ -54,16 +64,17 @@ jobs:
host: ${{ secrets.HOST_PROD_2 }}
key: ${{ secrets.PRIVATE_KEY_CONTENTS }}
port: ${{ secrets.PORT }}
source: "./docker-compose-contents.yml"
source: "./BE-Contents-Server/docker-compose-contents.yml"
target: "/home/ec2-user/"

- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_CONTENTS }}
host: ${{ secrets.HOST_PROD_2 }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY_CONTENTS }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/contents:latest
docker image prune -a -f
docker-compose up -dons/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
cd ./BE-Contents-Server
docker-compose -f docker-compose-contents.yml up

0 comments on commit ff16190

Please sign in to comment.