Merge pull request #31 from Seasoning-Today/refactor/#17-implement-re… #11
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: deploy | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Create Secret Files | |
run: | | |
mkdir ./src/main/resources/secret | |
echo "${{ secrets.APPLICATION_PROD_CONFIG }}" > ./src/main/resources/secret/application-prod-config.yml | |
- name: Build Project | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean build -x test | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
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: Upload to AWS S3 | |
run: | | |
aws deploy push \ | |
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \ | |
--ignore-hidden-files \ | |
--s3-location s3://${{ secrets.S3_BUCKET_NAME }}/$GITHUB_SHA.zip \ | |
--source . | |
- name: Code Deploy To EC2 instance | |
run: | | |
aws deploy create-deployment \ | |
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \ | |
--deployment-config-name CodeDeployDefault.AllAtOnce \ | |
--deployment-group-name ${{ secrets.CODE_DEPLOY_GROUP_NAME }} \ | |
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip |