Skip to content

Merge pull request #348 from Hous-Release/fix/#338 #14

Merge pull request #348 from Hous-Release/fix/#338

Merge pull request #348 from Hous-Release/fix/#338 #14

# 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:
- hous-notification/**
- hous-core/**
- hous-common/**
- hous-external/**
env:
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME_DEV }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: create secret files
working-directory: hous-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/firebase_service_key.json
echo "${{ secrets.FIREBASE_SERVICE_KEY_JSON }}" >> ./firebase/firebase_service_key.json
sed -i 's/#/"/g' ./firebase/firebase_service_key.json
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
- 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 hous-notification:bootJar -x test
shell: bash
- name: Make zip file
run: zip -r ./notification-code-deploy.zip ./hous-notification/build/libs/*.jar ./scripts/hous-notification/* -j
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_DEV }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_KEY_DEV }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./notification-code-deploy.zip s3://$AWS_S3_BUCKET_NAME/notification-code-deploy.zip
- name: Code Deploy
run: aws deploy create-deployment
--application-name hous-codedeploy
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name NOTIFICATION
--s3-location bucket=$AWS_S3_BUCKET_NAME,bundleType=zip,key=notification-code-deploy.zip