Skip to content

FIX: 폼 Category 부분 DUMMY 삭제 #1368

FIX: 폼 Category 부분 DUMMY 삭제

FIX: 폼 Category 부분 DUMMY 삭제 #1368

Workflow file for this run

name: CI/CD
on:
push:
paths:
- "backend/**"
workflow_dispatch:
jobs:
backend-CI:
runs-on: ubuntu-latest
steps:
- name: 체크아웃
uses: actions/checkout@v3
- name: JDK 11 설정
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "corretto"
- name: Setup Dev Environment
if: ${{ 'refs/heads/dev' == github.ref }}
run: |
echo "ENVIRONMENT=dev" >> $GITHUB_ENV
echo "S3_BUCKET=dev.cabi-server-deploy" >> $GITHUB_ENV
echo "CODEDEPLOY_APP=cabi-dev" >> $GITHUB_ENV
echo "CODEDEPLOY_GROUP=cabi-dev-group" >> $GITHUB_ENV
echo "DOCKER_IMAGE=ccabi/cabi-dev" >> $GITHUB_ENV
- name: Setup Main Environment
if: ${{ 'refs/heads/main' == github.ref }}
run: |
echo "ENVIRONMENT=main" >> $GITHUB_ENV
echo "S3_BUCKET=main.cabi-server-deploy" >> $GITHUB_ENV
echo "CODEDEPLOY_APP=cabi-main" >> $GITHUB_ENV
echo "CODEDEPLOY_GROUP=cabi-main-group" >> $GITHUB_ENV
echo "DOCKER_IMAGE=ccabi/cabi-main" >> $GITHUB_ENV
- name: Cache Gradle packages
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: Gradle 빌드
run: |
cd backend
mkdir -p build/generated-snippets/
chmod +x gradlew
./gradlew build -x test
shell: bash
- name: Log in to Docker Hub
if: ${{ format('refs/heads/{0}', env.ENVIRONMENT) == github.ref }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
if: ${{ format('refs/heads/{0}', env.ENVIRONMENT) == github.ref }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE }}
tags: latest
- name: Build and push Docker image
if: ${{ format('refs/heads/{0}', env.ENVIRONMENT) == github.ref }}
uses: docker/build-push-action@v5
with:
context: .
file: ./deploy-${{ env.ENVIRONMENT }}/pinpoint-application/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Configure AWS credentials
if: ${{ format('refs/heads/{0}', env.ENVIRONMENT) == github.ref }}
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3 and deploy
if: ${{ format('refs/heads/{0}', env.ENVIRONMENT) == github.ref }}
run: |
env_file="deploy-${{ env.ENVIRONMENT }}/pinpoint-application/.env"
agent_env_file="deploy-${{ env.ENVIRONMENT }}/pinpoint-agent/.env"
echo "${{ secrets[format('PINPOINT_APPLICATION_{0}_ENV', env.ENVIRONMENT)] }}" | base64 --decode > $env_file
echo "${{ secrets[format('PINPOINT_AGENT_{0}_ENV', env.ENVIRONMENT)] }}" | base64 --decode > $agent_env_file
mkdir -p deploy && cp -r deploy-${{ env.ENVIRONMENT }}/* deploy/
zip -r deploy.zip deploy
aws s3 cp deploy.zip s3://${{ env.S3_BUCKET }}/deploy.zip
aws deploy create-deployment \
--application-name ${{ ENV.CODEDEPLOY_APP }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ ENV.CODEDEPLOY_GROUP }} \
--file-exists-behavior OVERWRITE \
--s3-location bucket=${{ env.S3_BUCKET }},bundleType=zip,key=deploy.zip