Update CI configuration (#3120)

* Update config.yml

* Add `npm prune` command

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

* Ensure package-lock.json exists
This commit is contained in:
Acid Chicken (硫酸鶏) 2018-11-05 17:38:57 +09:00 committed by syuilo
parent 9d29a2e85a
commit 12f932d48a

View file

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