Skip to content

Merge pull request #43 from Team-Plu/fix/#42 #19

Merge pull request #43 from Team-Plu/fix/#42

Merge pull request #43 from Team-Plu/fix/#42 #19

# This is a basic workflow to help you get started with Actions
name: notification-deploy-dev
# Controls when the workflow will run
on:
push:
branches: [ develop ]
paths:
- .github/workflows/**
- plu-notification/**
- plu-common/**
- plu-domain/**
- plu-external/**
env:
AWS_S3_BUCKET: plu-s3
jobs:
build:
runs-on: ubuntu-latest
steps:
# μ›Œν¬ν”Œλ‘œμš° μ‹€ν–‰ μ „ 기본적으둜 체크아웃 ν•„μš”
- name: Checkout
uses: actions/checkout@v3
# Firebase secret 파일 생성
- name: create secret files
working-directory: plu-notification/src/main/resources
run: |
touch application.yml
touch application-dev.yml
echo "${{ secrets.NOTIFICATION_YML }}" > application.yml
echo "${{ secrets.NOTIFICATION_DEV_YML }}" > application-dev.yml
mkdir firebase
touch ./firebase/plu-firebase-config.json
echo "${{ secrets.FIREBASE_SERVICE_KEY_JSON }}" > ./firebase/plu-firebase-config.json
sed -i 's/#/"/g' ./firebase/plu-firebase-config.json
# JDK 11버전
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
# build
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
# - name: Test with Gradle
# run: ./gradlew test
- name: Build with Gradle
run: ./gradlew plu-notification:bootJar -x test
shell: bash
- name: Make zip file
run: zip -r ./notification-code-deploy.zip ./plu-notification/build/libs/*.jar ./scripts/plu-notification/* -j
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_DEV }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./notification-code-deploy.zip s3://$AWS_S3_BUCKET/notification-code-deploy.zip
- name: Code Deploy
run: aws deploy create-deployment
--application-name plu-application
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name NOTIFICATION
--s3-location bucket=$AWS_S3_BUCKET,bundleType=zip,key=notification-code-deploy.zip