Skip to content

πŸ›: bugfix CodeDeploy Script at specified location: run_new_was.sh fai… #3

πŸ›: bugfix CodeDeploy Script at specified location: run_new_was.sh fai…

πŸ›: bugfix CodeDeploy Script at specified location: run_new_was.sh fai… #3

Workflow file for this run

name: API Server Java CD with Gradle on DEV
# develop λΈŒλžœμΉ˜μ— push μ‹œμ— λ™μž‘
on:
push:
branches: [ "develop" ]
env:
S3_BUCKET_NAME: codere-s3
jobs:
build:
name: Code deployment
# μ‹€ν–‰ ν™˜κ²½
runs-on: ubuntu-latest
steps:
# 1) μ›Œν¬ν”Œλ‘œμš° μ‹€ν–‰ μ „ 기본적으둜 체크아웃 ν•„μš”
- name: checkout
uses: actions/checkout@v3
# 2) JDK 11버전 μ„€μΉ˜, λ‹€λ₯Έ JDK 버전을 μ‚¬μš©ν•˜λ‹€λ©΄ μˆ˜μ •
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
# 3) application.yml μ„ΈνŒ…
- name: setting application.yml
run: |
cd ./src/main/resources # resources ν΄λ”λ‘œ 이동
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml
echo "${{ secrets.APPLICATION_DEV_YML }}" > ./application-dev.yml
shell: bash
# 4) build
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle # μ‹€μ œ application build(-x μ˜΅μ…˜μ„ 톡해 ν…ŒμŠ€νŠΈλŠ” μ œμ™Έ)
run: ./gradlew clean build -x test
# 5) 배포 νŒŒμΌμ„ 담을 디렉토리 생성
- name: Make Directory
run: mkdir -p deploy
# 6) Jar 파일 볡사
- name: Copy Jar
run: cp ./build/libs/*.jar ./deploy
# 7) appspec.yml, script files 볡사
- name: Copy files
run: cp ./scripts/* ./deploy
# 8) 배포 μ••μΆ• 파일 생성
- name: Make zip file
run: zip -r ./core.zip ./deploy
shell: bash
# 9) S3에 배포 μ••μΆ• 파일 μ—…λ‘œλ“œ
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_DEV }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./core.zip s3://$S3_BUCKET_NAME/
# Deploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY_DEV }}
run:
aws deploy create-deployment
--application-name core-codeDeploy
--deployment-group-name API_SERVER
--file-exists-behavior OVERWRITE
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=core.zip
--region ap-northeast-2