Skip to content

fix: JPE 포맷 형식 삭제 #5

fix: JPE 포맷 형식 삭제

fix: JPE 포맷 형식 삭제 #5

Workflow file for this run

name: ci-cd
on:
push:
branches: [infra/#8-cicd, dev, release]
permissions:
contents: read
jobs:
build-image:
runs-on: ubuntu-latest
environment: dev
defaults:
run:
shell: bash
working-directory: ./be/carrot
steps:
- uses: actions/checkout@v3
## JDK Setting
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'termurin'
# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
# cache directory setting
path:
~/.gradle/caches
~/.gradle/wrapper
# separate cache key setting
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# 이전에 생성된 캐시 복원에 사용할 키 지정
# 캐시가 없거나 만료되었을 때, 이 키를 기반으로 이전에 생성된 캐시를 찾아 복원
restore-keys: |
${{ runner.os }}-gradle-
# 환경별 yml 파일 생성(1) - application.yml
- name: make application.yml
if: |
contains(github.ref, 'dev') ||
contains(github.ref, 'release') ||
contains(github.ref, 'infra/#8-cicd')
run: |
mkdir ./src/main/resources
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_COMMON }}" > ./applicaiton.yml
shell: bash
# 환경별 yml 파일 생성(2) - dev
- name: make application-dev.yml
if: contatins(github.ref, 'dev') ||

Check failure on line 56 in .github/workflows/cicd.yml

View workflow run for this annotation

GitHub Actions / ci-cd

Invalid workflow file

The workflow is not valid. .github/workflows/cicd.yml (Line: 56, Col: 13): Unrecognized function: 'contatins'. Located at position 1 within expression: contatins(github.ref, 'dev') || contains(github.ref, 'infra/#8-cicd')
contains(github.ref, 'infra/#8-cicd')
run: |
cd ./src/main/resources
touch ./application-dev.yml
echo "${{ secrets.APPLICATION_DEV }}" > ./application-dev.yml
shell: bash
# 환경별 yml 파일 생성(3) - release.yml
- name: make application-release.yml
if: contains(github.ref, 'release')
run:
cd ./src/main/resources
touch ./application-release.yml
echo "${{ secrets.APPLICATION_RELEASE }}" > ./application-release.yml
shell: bash
# gradlew 실행을 위한 실행 권한 부여
- name: Grant execute permission for gradlew
run: sudo chmod +x ./gradlew
# Gradle을 이용하여 빌드 수행
- name: Build with Gradle
run: sudo ./gradlew build -x test
# docker build & push to devleop
- name: Docker build & push to dev
if: contains(github.ref, 'dev') ||
contains(github.ref, 'infra/#8-cicd')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile-dev -t ${{ secrets.DOCKER_USERNAME }}/bee_market_app_dev .
docker push ${{ secrets.DOCKER_USERNAME }}/bee_market_app_dev
# docker build & push to release
- name: Docker build & push to release
if: contains(github.ref, 'release') ||
contains(github.ref, 'release')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile-release -t ${{ secrets.DOCKER_USERNAME }}/bee_market_app_release .
docker push ${{ secrets.DOCKER_USERNAME }}/bee_market_app_release
build-react-image:
runs-on: ubuntu-latest
environment: dev
defaults:
run:
shell: bash
working-directory: ./fe
strategy:
matrix:
node-version: [ 18.x ]
steps:
- uses: actions/checkout@v3
- name: Docker build to dev
if: contains(github.ref, 'dev') ||
contains(github.ref, 'infra/#8-cicd')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p & {{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile-dev -t ${{ secrets.DOCKER_USERNAME }}/bee_market_web_dev .
docker push ${{ secrets.DOCKER_USERNAME }}/bee_market_web_dev
- name: Docker build to release
if: contains(github.ref, 'release')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile-release -t ${{ secrets.DOCKER_USERNAME }}/bee_market_web_release .
docker push ${{ secrets.DOCKER_USERNAME }}/bee_market_web_release
cd-pipeline:
needs:
- build-image
- build-react-image
name: continuos deploy
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@master
# nginx-dev-conf 파일 EC2에 업로드
- name: copy nginx-dev.conf file via ssh password
uses: appleboy/scp-action@master
if: contains(github.ref, 'dev') ||
contains(github.ref, 'infra/#8-cicd')
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
port: 22
source: "./nginx/nginx-dev.conf"
target: "/home/ec2-user/"
# nginx-release.conf 파일 EC2에 업로드
- name: copy nginx-release.conf file via ssh password
uses: appleboy/scp-action@master
if: contains(github.ref, 'release')
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
port: 22
source: "./nginx/nginx-release.conf"
target: "/home/ec2-user/"
# docker-compose-dev.yml 파일 EC2에 업로드
- name: copy docker-compose-dev file via ssh password
uses: appleboy/scp-action@master
if: contains(github.ref, 'dev') ||
contains(github.ref, 'infra/#8-cicd')
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
port: 22
source: "docker-compose-dev.yml"
target: "/home/ec2-user/"
# docker-compose-release.yml 파일 EC2에 업로드
- name: copy docker-compose-release file via ssh password
uses: appleboy/scp-action@master
if: contains(github.ref, 'release')
with:
host: ${{ secrets.HOST }}
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }}
port: 22
source: "docker-compose-release.yml"
target: "/home/ec2-user/"
# docer-compose-dev 실행
- name: Deploy to dev
uses: appleboy/ssh-action@master
if: contains(github.ref, 'dev') ||
contains(github.ref, 'infra/#8-cicd')
with:
host: ${{ secrets.HOST }} # EC2 인스턴스 퍼블릭 DNS
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }} # pem Key
port: 22
script: |
sudo chmod 666 /var/run/docker.sock
docker-compose -f docker-compose-dev.yml down -v
docker-compose -f docker-compose-dev.yml pull
docker-compose -f dokcer-compose-dev.yml up-d
docker image prune -f
# docker-compose-release 실행
- name: Deploy to release
uses: appleboy/ssh-action@master
if: contains(github.ref, 'release')
with:
host: ${{ secrets.HOST }} # EC2 인스턴스 퍼블릭 DNS
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }} # pem 키
port: 22
script: |
sudo chmod 666 /var/run/docker.sock
docker-compose -f docker-compose-release.yml down -v
docker-compose -f docker-compose-release.yml pull
docker-compose -f docker-compose-release.yml up -d
docker image prune -f