Skip to content

Merge pull request #107 from Seasoning-Today/refactor/#97-centralized… #64

Merge pull request #107 from Seasoning-Today/refactor/#97-centralized…

Merge pull request #107 from Seasoning-Today/refactor/#97-centralized… #64

Workflow file for this run

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: Zip Project Files
run: zip -r application.zip .
- name: Upload to AWS S3
run: |
aws s3 cp --acl private application.zip s3://${{ secrets.S3_BUCKET_NAME }}/$GITHUB_SHA.zip
- name: Call CodeDeploy
run: |
aws deploy create-deployment \
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \
--deployment-group-name ${{ secrets.CODE_DEPLOY_GROUP_NAME }} \
--region ap-northeast-2 \
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip