Skip to content

Commit

Permalink
fix: CI/CD yml 합치기(임시)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamiwood committed Dec 20, 2024
1 parent af6d8c1 commit 107e0bf
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/itcast-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,41 @@ jobs:
- name: Tear down Docker Compose
if: always()
run: docker-compose down
run: docker-compose down

# DI
- name: Set Yaml
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-prod.yml
env:
spring.datasource.url: ${{secrets.KJH_MYSQL_URL}}
spring.datasource.username: ${{ secrets.KJH_DB_USERNAME }}
spring.datasource.password: ${{ secrets.KJH_DB_PASSWORD }}
spring.data.redis.host: ${{ secrets.KJH_REDIS_HOST }}
spring.data.redis.port: ${{ secrets.KJH_REDIS_PORT }}

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

- name: Make Zip file
run: zip -r $GITHUB_SHA.zip build/libs/*.jar appspec.yml scripts/deploy.sh
shell: bash

- name: AWS credential setting
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{secrets.AWS_KJH_REGION}}
aws-access-key-id: ${{secrets.AWS_KJH_ACCESS_KEY}}
aws-secret-access-key: ${{secrets.AWS_KJH_SECRET_ACCESS_KEY}}

- name: Upload to S3
run: aws s3 cp ./$GITHUB_SHA.zip s3://${{ secrets.AWS_S3_BUCKET }}/$GITHUB_SHA.zip

- name: EC2 Deploy
run: aws deploy create-deployment
--application-name ${{secrets.AWS_KJH_CODE_DEPLOY_APPLICATION}}
--deployment-config-name CodeDeployDefault.AllAtOnce
--deployment-group-name ${{secrets.AWS_KJH_CODE_DEPLOY_GROUP}}
--s3-location bucket=${{secrets.AWS_KJH_S3_BUCKET}},key=$GITHUB_SHA.zip,bundleType=zip

0 comments on commit 107e0bf

Please sign in to comment.