Skip to content

๐Ÿ› CORS ์˜ค๋ฅ˜ ์ˆ˜์ • #56

๐Ÿ› CORS ์˜ค๋ฅ˜ ์ˆ˜์ •

๐Ÿ› CORS ์˜ค๋ฅ˜ ์ˆ˜์ • #56

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle(deploy)
on:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
# JDK๋ฅผ 17 ๋ฒ„์ „์œผ๋กœ ์„ธํŒ…
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# Gradle ์บ์‹ฑ-> ๋นŒ๋“œ ์†๋„ UP
- 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-
# application-prod.yml ํŒŒ์ผ ์ƒ์„ฑ
- name: make application-prod.yml
run: |
cd ./src/main/resources
touch ./application-prod.yml
echo "${{ secrets.APPLICATION }}" >> ./application-prod.yml
shell: bash
# Gradle๋กœ ๋นŒ๋“œ ์‹คํ–‰
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew bootJar
# AWS์— ์—ฐ๊ฒฐ
- name: Connect to AWS
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 }}
# ๋นŒ๋“œ ํŒŒ์ผ์„ ZIP ํŒŒ์ผ๋กœ ์ƒ์„ฑ
- name: Make zip file
run: |
mkdir deploy
cp ./appspec.yml ./deploy/
#cp ./dockerfile ./deploy/
cp ./deploy.sh ./deploy/
cp ./build/libs/*.jar ./deploy/
zip -r -qq -j ./kidari-build.zip ./deploy
# S3์— zip ํŒŒ์ผ ์—…๋กœ๋“œ
- name: Upload to S3
run: |
aws s3 cp \
--region ap-northeast-2 \
./kidari-build.zip s3://kidari
# CodeDeploy์— ๋ฐฐํฌ ์š”์ฒญ
- name: Code Deploy Deployment Request
run: |
aws deploy create-deployment --application-name rekidari \
--deployment-config-name CodeDeployDefault.OneAtATime \
--deployment-group-name rekidari \
--s3-location bucket=kidari,bundleType=zip,key=kidari-build.zip
# ๋ฐฐํฌ ๊ฒฐ๊ณผ Slack ์•Œ๋žŒ ์ „์†ก
- name: Send Slack Alarms
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: general
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: ๋ฐฐํฌ ๊ฒฐ๊ณผ => ${{ job.status }}
SLACK_TITLE: ๋ฐฐํฌ ๊ฒฐ๊ณผ ์•Œ๋žŒ
SLACK_USERNAME: Notification-Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()