From 12f932d48ae9a3fde0805c70b86144b83f6fa33d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?=
 <root@acid-chicken.com>
Date: Mon, 5 Nov 2018 17:38:57 +0900
Subject: [PATCH] Update CI configuration (#3120)

* Update config.yml

* Add `npm prune` command

refs: https://misskey.xyz/notes/5bd9b87168b2a30045edb3aa

* Ensure package-lock.json exists
---
 .circleci/config.yml | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index b8d34ff7bb..0bd6df7e7c 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -23,6 +23,10 @@ jobs:
     executor: default
     steps:
       - checkout
+      - run:
+          name: Ensure package-lock.json
+          command: |
+            [ ! -e package-lock.json ] && echo '{}' > package-lock.json
       - restore_cache:
           name: Restore npm package caches
           keys:
@@ -35,6 +39,7 @@ jobs:
           name: Install Dependencies
           command: |
             npm install
+            npm prune
       - run:
           name: Configure
           command: |
@@ -50,8 +55,8 @@ jobs:
           key: npm-v1-arch-{{ arch }}-env-{{ .Environment.variableName }}-package-{{ checksum "package.json" }}-lock-{{ checksum "package-lock.json" }}-ls-{{ checksum "ls" }}
           paths:
             - node_modules
-      - store_artifacts:
-          path: built
+#      - store_artifacts:
+#          path: built
       - persist_to_workspace:
           root: .
           paths:
@@ -98,7 +103,6 @@ jobs:
           name: Build
           command: |
             docker build . | tee docker.log
-            tail -n 1 docker.log | read __Successfully __built tag
       - when:
           condition: <<parameters.with_deploy>>
           steps:
@@ -107,6 +111,7 @@ jobs:
                 command: |
                   if [ "$DOCKERHUB_USERNAME$DOCKERHUB_PASSWORD" ]
                    then
+                    tail -n 1 docker.log | read __Successfully __built tag
                     docker tag $tag misskey/misskey
                     docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
                     docker push misskey/misskey
@@ -126,10 +131,13 @@ workflows:
           without_redis: "true"
           requires:
             - build
-      - docker:
           filters:
             branches:
-              ignore: master
+              only: master
+#      - docker:
+#          filters:
+#            branches:
+#              ignore: master
       - docker:
           with_deploy: "true"
           filters: