-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (69 loc) · 2.57 KB
/
main.yml
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
name: farmmate-server
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Install ts-patch
run: npm install ts-patch --save-dev
- name: Check current directory and ts-patch installation
run: |
pwd
ls -l node_modules/.bin
npm list ts-patch
- name: Apply ts-patch
run: node_modules/.bin/ts-patch install
- name : Check npm list
run : ./node_modules/.bin/ts-patch install
- name: Install and apply typia
run: |
npm install typia
npx typia patch
- name: Build project
run: npm run build
- 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: Set up environment variables
run: |
echo "DB_TYPE=${{ secrets.DB_TYPE }}" >> $GITHUB_ENV
echo "DB_HOST=${{ secrets.DB_HOST }}" >> $GITHUB_ENV
echo "DB_PORT=${{ secrets.DB_PORT }}" >> $GITHUB_ENV
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> $GITHUB_ENV
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV
echo "DB_DATABASE=${{ secrets.DB_DATABASE }}" >> $GITHUB_ENV
- name: Check current directory
run: pwd
- name: List files
run: ls -la
- name: Build and zip the project
run: |
# 여기에 프로젝트 빌드 명령어 추가
zip -r ./$GITHUB_SHA.zip . # 이 부분이 파일을 압축하는 명령어입니다
- name: Upload to S3
run: aws s3 cp ./$GITHUB_SHA.zip s3://farmmate-bucket/$GITHUB_SHA.zip --region ap-northeast-2
- name: Code Deploy
run: aws deploy create-deployment --application-name $CODEDEPLOY_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $CODEDEPLOY_GROUP --s3-location bucket=${{ env.S3_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip
env:
NODE_ENV: development
AWS_REGION: ap-northeast-2
CODEDEPLOY_NAME: farmmate-server
CODEDEPLOY_GROUP: production
S3_BUCKET_NAME: farmmate-bucket