-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d139c46
commit aad6764
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CICD | ||
|
||
run-name: Running | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
AWS_REGION: ap-northeast-2 | ||
AWS_S3_BUCKET: app-release-files | ||
AWS_CODE_DEPLOY_APPLICATION: todaypopup-dev-cicd | ||
AWS_CODE_DEPLOY_GROUP: todaypopup-dev-cicd-group | ||
|
||
jobs: | ||
build-with-gradle: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: Set Yaml | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: ./src/main/resources/application-dev.yml | ||
env: | ||
spring.datasource.url: ${{ secrets.MYSQL_URL_DEV }} | ||
spring.datasource.username: ${{ secrets.MYSQL_USERNAME_DEV }} | ||
spring.datasource.password: ${{ secrets.MYSQL_PASSWORD_DEV }} | ||
|
||
- name: gradlew에 실행 권한 부여 | ||
run: chmod +x ./gradlew | ||
|
||
- name: 프로젝트 빌드 | ||
run: ./gradlew clean build -x test | ||
|
||
- name: AWS credential 설정 | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: ${{ env.AWS_REGION }} | ||
aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.CICD_SECRET_KEY }} | ||
|
||
- name: S3에 업로드 | ||
run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://$AWS_S3_BUCKET/todaypopup-dev-cicd/$GITHUB_SHA.zip --source . | ||
|
||
- name: EC2에 배포 | ||
run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=$AWS_S3_BUCKET,key=todaypopup-dev-cicd/$GITHUB_SHA.zip,bundleType=zip |