Skip to content

feat: 글 수정 시 로딩 화면 변경 #170

feat: 글 수정 시 로딩 화면 변경

feat: 글 수정 시 로딩 화면 변경 #170

name: dev CI/CD by Push/Merge
# dev 브랜치로 push 혹은 pr이 날라와서 merge되면 workflow가 작동합니다.
# workflow_dispatch는 수동으로 workflow를 작동시키도록 할 수 있도록 합니다.
on:
push:
branches:
- dev
env:
NODE_ENV: production
jobs:
integration-and-deploy:
name: integration and deployment
runs-on: ubuntu-latest # 어떤 OS 에서 실행될지 지정하는 것
env:
S3_BUCKET_NAME: gocham-dev-files # S3 버킷 이름입니다.
PROJECT_NAME: dev-gocham-service-web-react # S3 버킷 내 폴더 이름입니다. 임의로 정하면 알아서 생성해줍니다.
AWS_CODEDEPLOY_APPLICATION_NAME: dev-service-web-codedeploy # CodeDeploy 애플리케이션 이름입니다.
AWS_CODEDEPLOY_DEPLOYMENT_GROUP_NAME: dev-service-web-group # CodeDeploy 배포 그룹 이름입니다.
strategy:
matrix:
node-version: ['16.x']
steps:
- name: Checkout commits
uses: actions/checkout@v3 # 어떤 액션을 사용할지 지정하는 것
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Dependency들을 설치합니다. yarn도 사용 가능합니다.
- name: Install Dependencies
run: npm ci
# 빌드합니다.
- name: Build React
working-directory: ./
run: npm run build-dev
env:
CI: ""
# appspec 파일 복사
- name: Copy appspec.yml to match the environment variable
run: \cp -f ./appspec/appspec-dev.yml ./appspec.yml
- name: Remove appspec folder
run: rm -rf ./appspec
- name: Copy Deploy.sh
run: \cp -f ./deploy/deploy-dev.sh ./deploy-dev.sh
# 레포지토리를 압축시킵니다.
# 다만 불필요한 node_module, coverage, src, test, readme, .git* 등의 파일은 제외시킵니다.
- name: Make a zip file
run: zip -r build.zip . -x "node_modules/*" "coverage/*" "src/*" "test/*" "README.md" "*.git*"
shell: bash
# 위에서 생성한 IAM 사용자 정보를 넣어 자격 증명을 수행합니다.
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYYMMDD_HH:mm:ss
utcOffset: '+09:00'
# 위에서 만든 zip 파일을 S3에 업로드 합니다.
- name: Upload to S3
run: aws s3 cp --region ${{ secrets.AWS_REGION }} build.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/${{steps.current-time.outputs.formattedTime}}.zip
# CodeDeploy에게 deployment를 생성하도록 요청합니다.
- name: Request Deployment
run: aws deploy create-deployment --application-name $AWS_CODEDEPLOY_APPLICATION_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $AWS_CODEDEPLOY_DEPLOYMENT_GROUP_NAME --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/${{steps.current-time.outputs.formattedTime}}.zip
# slack webhook
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{job.status}}
fields: repo, ref, workflow, message, author
author_name: Github Actions 서비스 웹
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEV }}
if: always()