!hotfix: CORS 설정 변경 #171
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: CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "develop" ] | |
paths-ignore: | |
- '**/*.md' | |
permissions: | |
contents: read | |
jobs: | |
cd: | |
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' | |
## gradle 캐싱 | |
- 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- | |
## create application.yml | |
- name: make application-secret.yml | |
run: | | |
mkdir -p ./api/src/main/resources | |
touch ./api/src/main/resources/application-secret.yml | |
shell: bash | |
- name: deliver application-secret.yml | |
run: echo "${{ secrets.APPLICATION_SECRET }}" > ./api/src/main/resources/application-secret.yml | |
shell: bash | |
## firebase-key 설정 | |
- name: Set FCM | |
env: | |
DATA: ${{ secrets.FIREBASE_KEY }} | |
run: | | |
mkdir -p ./core/core-infra-firebase/src/main/resources/firebase | |
echo $DATA > ./core/core-infra-firebase/src/main/resources/firebase/firebase-key.json | |
# 빌드 및 테스트 단계. | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
# gradle build | |
- name: Build with Gradle | |
run: ./gradlew clean build -x test | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: beanstalk | |
IMAGE_TAG: latest | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" | |
- name: Show Current Time | |
run: echo "CurrentTime=${{ steps.current-time.outputs.formattedTime }}" | |
shell: bash | |
- name: Generate deployment package | |
run: | | |
mkdir -p deploy | |
cp -r .ebextensions-dev deploy/.ebextensions | |
cp -r .platform deploy/.platform | |
cp Dockerrun.aws.json deploy/Dockerrun.aws.json | |
cd deploy && zip -r deploy.zip . | |
- name: Beanstalk Deploy | |
uses: einaregilsson/beanstalk-deploy@v20 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
application_name: project-prod-study | |
environment_name: Project-prod-study-env | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: deploy/deploy.zip | |
wait_for_deployment: false |