-
Notifications
You must be signed in to change notification settings - Fork 3
105 lines (87 loc) · 3.82 KB
/
deploy-dev.yml
File metadata and controls
105 lines (87 loc) · 3.82 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
103
104
105
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [dev]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-18.04
env:
client-directory: ./client
server-directory: ./server
admin-directory: ./admin
IMAGE_TAG: ${{ github.sha }}
strategy:
matrix:
node-version: ["14.x"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install client dependencies
run: yarn
working-directory: ${{ env.client-directory }}
- name: Run client build
run: yarn build
working-directory: ${{ env.client-directory }}
env:
REACT_APP_NAVER_MAPS_CLIENT_ID: ${{ secrets.DEV_REACT_APP_NAVER_MAPS_CLIENT_ID }}
REACT_APP_APP_ID: ${{ secrets.DEV_REACT_APP_APP_ID }}
REACT_APP_ENDPOINT: ${{ secrets.DEV_REACT_APP_ENDPOINT }}
REACT_APP_LOGIN: ${{ secrets.DEV_REACT_APP_LOGIN }}
REACT_APP_MIXPANEL_TOKEN: ${{ secrets.DEV_REACT_APP_MIXPANEL_TOKEN }}
REACT_APP_INSTALL: ${{ secrets.DEV_REACT_APP_INSTALL }}
- name: Install server dependencies
run: npm install
working-directory: ${{ env.server-directory }}
- name: Run server build
run: npm run build
working-directory: ${{ env.server-directory }}
- name: Install admin dependencies
run: yarn
working-directory: ${{ env.admin-directory }}
- name: Run admin build
run: yarn build
working-directory: ${{ env.admin-directory }}
env:
REACT_APP_SERVER: ${{ secrets.REACT_APP_SERVER }}
- name: configure AWS
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: Login to ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# - name: Build, tag, and push image to ECR
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: mymapdeploy
# IMAGE_TAG: ${{ github.sha }}
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
# find ./ -name "*docker-compose.*.yml" -exec perl -pi -e "s/tagname/$IMAGE_TAG/g" {} \;
- name: admin upload
run: |
aws s3 cp \
--recursive \
build s3://mymap-admin/admin
working-directory: ${{ env.admin-directory }}
- name: S3 Upload
run: aws deploy push --application-name mymap-dev-deploy --description "mymap dev server deploy" --s3-location s3://mymapdeploy/deploy_dev_$IMAGE_TAG.zip --source .
- name: code deploy
run: aws deploy create-deployment --application-name mymap-dev-deploy --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name mymap-dev --s3-location bucket=mymapdeploy,bundleType=zip,key=deploy_dev_$IMAGE_TAG.zip