Skip to content

Commit

Permalink
fix: CI/CD 분리 git token 부여
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamiwood committed Dec 20, 2024
1 parent d796615 commit b842488
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/itcast-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.KJH_TOKEN }}

- name: Checkout code
uses: actions/checkout@v3

Expand Down Expand Up @@ -77,7 +82,7 @@ jobs:
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
run: aws s3 cp ./$GITHUB_SHA.zip s3://${{ secrets.AWS_KJH_S3_BUCKET }}/$GITHUB_SHA.zip

- name: EC2 Deploy
run: aws deploy create-deployment
Expand Down
39 changes: 1 addition & 38 deletions .github/workflows/itcast-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,41 +51,4 @@ jobs:
- name: Tear down Docker Compose
if: always()
run: docker-compose down

# DI
- name: Set Yaml
uses: microsoft/variable-substitution@v1
with:
files: ./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_KJH_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
run: docker-compose down

0 comments on commit b842488

Please sign in to comment.