-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (84 loc) · 3.08 KB
/
dev_deploy.yml
File metadata and controls
102 lines (84 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Node.js Dev CI/CD
on:
pull_request:
types: [ closed ]
workflow_dispatch:
jobs:
build:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x']
steps:
- uses: actions/checkout@v3
# Node.js 세팅
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Download AWS CLI 2
- name: Install AWS CLI 2
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
which aws
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
# Configure AWS credentials
- 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: ${{ secrets.AWS_REGION }}
# npm install for ci
- run: |
npm install
npm i passport passport-kakao -S
npm install moment-timezone
# Build
- run: npm run build
# Unit test
#- run: npm run test:unit
- name: Generate deployment package
run: |
cp -R .platform dist
cp package.json dist/package.json
cp package-lock.json dist/package-lock.json
cp Procfile dist/Procfile
cp -r swagger dist
cd dist
zip -r deploy.zip .
- name: Get Zip Inside
run: zipinfo -1 dist/deploy.zip
# 현재 시간 얻기 (Build 시점의 시간 얻기)
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00" # 한국 시간 고려
# 현재 시간 출력 (위에서 얻은 build 시점의 시간 보여주기)
- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}"
shell: bash
# Deploy to Elastic Beanstalk
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: ${{ secrets.APPLICATION_NAME }}
environment_name: ${{ secrets.ENVIRONMENT_NAME }}
region: ${{ secrets.AWS_REGION }}
deployment_package: dist/deploy.zip
use_existing_version_if_available: true
version_label: "v1.0.${{ github.run_number }}-${{ github.SHA }}"
wait_for_deployment: false
- name: Deployed!
run: echo App deployed to ELB