Skip to content

Commit

Permalink
Merge branch 'dev' into fix/#199
Browse files Browse the repository at this point in the history
  • Loading branch information
yeon015 authored Sep 3, 2024
2 parents f9135e0 + 34c50dc commit f29bf22
Show file tree
Hide file tree
Showing 53 changed files with 578 additions and 422 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# .github/workflows/dev-cd.yml
name: CD for Dev

on:
push:
branches: [ "dev" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Create application-dev.yml
run: |
mkdir -p ./src/main/resources
echo "${{ secrets.PROPERTIES_DEV }}" > ./src/main/resources/application-dev.yml
shell: bash

- name: Create .p8
run: |
echo "${{ secrets.APPLE_AUTH }}" > ./src/main/resources/AUTHKEY_JUINJAG.p8
shell: bash

- name: Build With Gradle
run: ./gradlew build -x test


- name: Login to Docker Hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-dev
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO_DEV }}


- name: Deploy to Dev
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ${{ secrets.EC2_USERNAME_DEV }}
key: ${{ secrets.EC2_PRIVATE_KEY_DEV }}
port: 22
script: |
sudo docker rm -f $(docker ps -qa) || true
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO_DEV }}
docker-compose up -d
docker image prune -f
36 changes: 36 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/dev-ci.yml
name: CI-Dev

on:
pull_request:
branches: [ "dev" ]


jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build With Gradle
run: ./gradlew build -x test
93 changes: 0 additions & 93 deletions .github/workflows/gradle.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# .github/workflows/prod-cd.yml
name: CD for Prod

on:
push:
branches: [ "prod" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Create application-prod.yml
run: |
mkdir -p ./src/main/resources
echo "${{ secrets.PROPERTIES_PROD }}" > ./src/main/resources/application-prod.yml
shell: bash

- name: Create .p8
run: |
echo "${{ secrets.APPLE_AUTH }}" > ./src/main/resources/AUTHKEY_JUINJAG.p8
shell: bash

- name: Build With Gradle
run: ./gradlew build -x test

- name: Login to Docker Hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-prod
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO_PROD }}

- name: Deploy to Prod
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST_PROD }}
username: ${{ secrets.EC2_USERNAME_PROD }}
key: ${{ secrets.EC2_PRIVATE_KEY_PROD }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO_PROD }}
chmod 777 ./deploy.sh
./deploy.sh
docker image prune -f
38 changes: 38 additions & 0 deletions .github/workflows/prod-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# .github/workflows/prod-ci.yml
name: CI-Prod

on:
pull_request:
branches: [ "prod" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build With Gradle
run: ./gradlew build -x test
29 changes: 0 additions & 29 deletions .github/workflows/test.yml

This file was deleted.

9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ out/
/application.properties
/src/main/resources/application.properties

/src/main/resources/*.yml


/application.yml
/src/main/resources/application.yml

/src/main/resources/local-application.yml
/src/main/resources/dev-application.yml
/src/main/resources/application-local.yml
/src/main/resources/application-dev.yml
/src/main/resources/application-prod.yml
/src/main/generated/*
Loading

0 comments on commit f29bf22

Please sign in to comment.