Skip to content

Commit

Permalink
Merge pull request #8 from Sean-creative/sean
Browse files Browse the repository at this point in the history
sean->main 배포 테스트
  • Loading branch information
Sean-creative authored Nov 8, 2023
2 parents 54ee3e2 + e961e2a commit d4c0f37
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: Running
on:
push:
branches:
- production
- main

env:
AWS_REGION: ap-northeast-2
Expand All @@ -26,25 +26,37 @@ jobs:
java-version: '16'
distribution: 'corretto'

# - name: Create application.properties
# working-directory: ./src/main/resources
# run: |
# touch application.properties
# echo '${{ secrets.APPLICATION_PROPERTIES }}' >> application.properties
# echo '${{ secrets.APPLICATION_PROPERTIES_DEPLOY }}' >> application-deploy.properties
- name: application.properties 파일 생성
run: touch ./src/main/resources/application.properties
- name: application.properties에 작성
run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties
- name: application.properties 내용 표시
run: cat ./src/main/resources/application.properties

- 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/cicdtest/$GITHUB_SHA.zip --source .
run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --s3-location s3://$AWS_S3_BUCKET/cicdtest/$GITHUB_SHA.zip --source .
run:
aws deploy push
--application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }}
--ignore-hidden-files
--s3-location s3://$AWS_S3_BUCKET/cicdtest/$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=cicdtest/$GITHUB_SHA.zip,bundleType=zip
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=cicdtest/$GITHUB_SHA.zip,bundleType=zip

0 comments on commit d4c0f37

Please sign in to comment.