.gitlab-ci.yml 1.05 KB
Newer Older
Ole Christian Eidheim's avatar
Ole Christian Eidheim committed
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
image: node:latest

stages:
  - build  # Jobs placed in build-stage will run first
  - test   # Jobs placed in tets-stage will run after build-jobs
  - deploy # Jobs placed in build-stage will run last after test-jobs

install:
  stage: build
  script:
    - npm install
  # Keep node_modules-folder for the following stages:
  artifacts:
    paths:
      - node_modules

test:
  stage: test # Job test will run in parallel with the job flow
  script:
    - npm test

flow:
  stage: test # Job flow will run in parallel with the job test
  script:
    - npm install --global flow-bin
    - flow check

deploy:
  stage: deploy
  script:
    - mkdir ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - touch ~/.ssh/id_rsa
    - chmod 600 ~/.ssh/id_rsa # Required permission by ssh
    - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
    - apt-get update
    - apt-get install --assume-yes rsync
38
    - rsync --archive --delete --exclude='.git' --exclude='node_modules' . app@129.241.96.146:app
39
    - ssh app@129.241.96.146 systemctl --user restart app
Ole Christian Eidheim's avatar
Ole Christian Eidheim committed
40 41
  only:
    - master