Update README.md #72
Workflow file for this run
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
# 워크 플로의 이름 | |
name: CI/CD | |
# 워크 플로의 시작 조건: main 브랜치에 push | |
on: | |
push: | |
branches: | |
- '*' | |
env: | |
PROJECT_NAME: hello-there | |
BUCKET_NAME: chrome-bucket | |
CODE_DEPLOY_APP_NAME: hello-there | |
DEPLOYMENT_GROUP_NAME: hello-there-group | |
jobs: | |
build: | |
runs-on: ubuntu-latest # 실행 환경 | |
# 작업의 실행 단계를 정의 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GIT_TOKEN }} | |
submodules: true | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Set YML | |
run: | | |
mkdir -p src/main/resources | |
echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml | |
echo "${{ secrets.SERVICE_ACCOUNT_KEY_JSON }}" | base64 --decode > src/main/resources/ServiceAccountKey.json | |
find src | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
- name: Make zip file # zip 파일 생성 | |
run: zip -r ./$GITHUB_SHA.zip . | |
shell: bash | |
# AWS 자격 증명 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Upload to S3 # S3 업로드 | |
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip | |
- name: Code Deploy # CodeDeploy에 배포 요청 | |
run: aws deploy create-deployment --application-name $CODE_DEPLOY_APP_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $DEPLOYMENT_GROUP_NAME --s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip |