Skip to content

Commit

Permalink
Merge branch 'dev' into feat/1
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling authored Feb 21, 2024
2 parents 60e6065 + 3e1032d commit 7f07c01
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 1 deletion.
69 changes: 69 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: cd

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Gradle Caching
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make application-prod.yml
run: |
cd ./src/main/resources
touch ./application-prod.yml
echo "${{ secrets.APPLICATION_PROD }}" > ./application-prod.yml
shell: bash

- name: Grant Execute Permission For Gradlew
run: chmod +x gradlew

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

- name: Docker build & push to docker repo
env:
DOCKER_PATH : .deploy/Dockerfile
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f $DOCKER_PATH -t ${{ secrets.DOCKER_REPO }}/mookive .
docker push ${{ secrets.DOCKER_REPO }}/mookive
- name: Deploy to Prob
uses: appleboy/ssh-action@master
id: deploy-prob
env:
DOCKER_COMPOSE : ".deploy/docker-compose.yml"
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_KEY }}
envs: GITHUB_SHA
script: |
touch ./docker-compose.yml
echo "${{ secrets.DOCKER_COMPOSE }}" > ./docker-compose.yml
docker stop mookive
docker rm mookive
docker pull ${{ secrets.DOCKER_REPO }}/mookive
docker-compose up -d
docker image prune
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ci

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/Setup-java@v4
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
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring:
profiles:
include:
- prod
- prod

0 comments on commit 7f07c01

Please sign in to comment.