From c3545f97730f8a6e356bd47fdb9468e4deee1ef8 Mon Sep 17 00:00:00 2001
From: dhoonjang <dhoonjang@gmail.com>
Date: Thu, 17 Dec 2020 02:59:29 +0900
Subject: [PATCH] set: gitlab ci/cd

---
 .eslintcache   |  1 +
 .gitlab-ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/App.tsx    | 10 ++++-----
 3 files changed, 66 insertions(+), 6 deletions(-)
 create mode 100644 .eslintcache
 create mode 100644 .gitlab-ci.yml

diff --git a/.eslintcache b/.eslintcache
new file mode 100644
index 0000000..bb0e583
--- /dev/null
+++ b/.eslintcache
@@ -0,0 +1 @@
+[{"/Users/dhoonjang/local/cd-tutorial/src/reportWebVitals.ts":"1","/Users/dhoonjang/local/cd-tutorial/src/App.tsx":"2"},{"size":425,"mtime":1608141108348,"results":"3","hashOfConfig":"4"},{"size":513,"mtime":1608141220740,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1izlfld",{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/dhoonjang/local/cd-tutorial/src/reportWebVitals.ts",[],"/Users/dhoonjang/local/cd-tutorial/src/App.tsx",[]]
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..64bd4c6
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,61 @@
+image: node:latest
+
+stages:
+  - install
+  - build
+  - deploy
+
+install:
+  stage: install
+  script:
+    - apt-get update -qq && apt-get install
+    - yarn config set cache-folder .yarn
+    - yarn install
+  artifacts:
+    name: "artifacts"
+    untracked: true
+    expire_in: 30 mins
+    paths:
+      - .yarn/
+      - node_modules/
+  rules:
+    - if: $CI_COMMIT_REF_NAME == "master"
+      when: always
+    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
+      when: always
+    - when: never
+
+build:
+  stage: build
+  dependencies:
+    - install
+  script:
+    - yarn build
+  artifacts:
+    paths:
+      - build
+    expire_in: 30 mins
+  rules:
+    - if: $CI_COMMIT_REF_NAME == "master"
+      when: on_success
+    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
+      when: on_success
+    - when: never
+
+deploy:
+  image: python:latest
+  stage: deploy
+  dependencies:
+    - build
+  variables:
+    S3_BUCKET_NAME: gitlab-cd-tutorial.git.ajou.ac.kr
+  before_script:
+    - pip install awscli
+  script:
+    - aws s3 sync build s3://$S3_BUCKET_NAME/ --acl public-read
+  rules:
+    - if: $CI_COMMIT_REF_NAME == "master"
+      when: on_success
+    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
+      when: on_success
+    - when: never
diff --git a/src/App.tsx b/src/App.tsx
index a53698a..62472bf 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,15 +1,13 @@
-import React from 'react';
-import logo from './logo.svg';
-import './App.css';
+import React from "react";
+import logo from "./logo.svg";
+import "./App.css";
 
 function App() {
   return (
     <div className="App">
       <header className="App-header">
         <img src={logo} className="App-logo" alt="logo" />
-        <p>
-          Edit <code>src/App.tsx</code> and save to reload.
-        </p>
+        <p>Jang Dong Hoon - dhoonjang</p>
         <a
           className="App-link"
           href="https://reactjs.org"
-- 
GitLab