[BE] FIX: 서버 오류 알림 템플릿 수정 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: backend CI | |
on: | |
push: | |
paths: | |
- "backend/**" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "11" | |
distribution: "corretto" | |
- 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: Build with Gradle | |
run: | | |
cd backend | |
chmod +x gradlew | |
./gradlew build | |
shell: bash | |
- name: Configure AWS credentials | |
if: ${{ github.ref == 'refs/heads/main' }} | |
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: ap-northeast-2 | |
- name: Login to Amazon ECR | |
if: ${{ github.ref == 'refs/heads/main' }} | |
id: login-ecr | |
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/y1h8l9n2 | |
- name: Build and push image to Amazon ECR | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
REGISTRY: public.ecr.aws | |
REGISTRY_ALIAS: y1h8l9n2 | |
REPOSITORY: diary-server-main | |
IMAGE_TAG: latest | |
run: | | |
cp backend/build/libs/*-*.jar deploy-main/ | |
cd deploy-main | |
docker build --platform linux/arm64 -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG . | |
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG | |
- name: Upload build file to S3 and trigger CodeDeploy | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
mkdir -p deploy && cp -r deploy-main/* deploy/ | |
zip -r deploy.zip deploy | |
aws s3 cp deploy.zip s3://${{ secrets.AWS_S3_MAIN_BUCKET_NAME }}/deploy.zip | |
aws deploy create-deployment \ | |
--application-name ${{ secrets.AWS_CODEDEPLOY_MAIN_APP_NAME }} \ | |
--deployment-config-name CodeDeployDefault.AllAtOnce \ | |
--deployment-group-name ${{ secrets.AWS_CODEDEPLOY_MAIN_GROUP_NAME }} \ | |
--file-exists-behavior OVERWRITE \ | |
--s3-location bucket=${{ secrets.AWS_S3_MAIN_BUCKET_NAME }},bundleType=zip,key=deploy.zip |