feat: branch명 수정 #1
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: Deploy To EC2 | |
on: | |
push: | |
branches: [ "github-actions" ] | |
env: | |
CODE_DEPLOY_APP_NAME: code-deploy-app | |
DEPLOYMENT_GROUP_NAME: code-deploy-group | |
REPOSITORY_NAME: JSCODE-EDU/auto-scaling-sample | |
jobs: | |
deployment: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" # 배포 서버의 Node 버전과 일치시켜주는 게 좋다. | |
- name: Install Libraries | |
run: npm ci | |
- name: Create Env File | |
run: | | |
touch .env | |
echo '${{ secrets.ENV }}' >> .env | |
## 테스트 코드가 있는 경우 | |
# - name: Test | |
# run: npm run test | |
- 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_PRIVATE_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Code Deploy To EC2 instance | |
run: aws deploy create-deployment | |
--application-name $CODE_DEPLOY_APP_NAME | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name $DEPLOYMENT_GROUP_NAME | |
--github-location repository=$REPOSITORY_NAME,commitId=$GITHUB_SHA |