Merge pull request #76 from LikeKNU/develop #1
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 to AWS CodeDeploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build Spring Boot application | |
run: ./gradlew clean build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
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 S3 | |
run: aws deploy push | |
--application-name LikeKNU | |
--ignore-hidden-files | |
--s3-location s3://like-knu-bucket/archive/$GITHUB_SHA.zip | |
--source . | |
- name: EC2μ λ°°ν¬ | |
run: aws deploy create-deployment | |
--application-name LikeKNU | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name LikeKNU-Deployment-group | |
--s3-location bucket=like-knu-bucket,key=archive/$GITHUB_SHA.zip,bundleType=zip |