Files
web2.0-frontend/.gitlab-ci.yml
T
2018-07-25 11:38:29 +03:00

96 lines
2.2 KiB
YAML

stages:
- setup
# - test
- lint
- publish
- deploy_dev
cache:
untracked: true
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
setup:
stage: setup
script:
- npm install
# test:unit:
# image: node:7.10.0
# stage: test
# script:
# - npm run test:unit
# test:e2e:
# image: node:7.10.0
# stage: test
# script:
# - npm run test:e2e
ts:lint:
image: node:7.10.0
stage: lint
script:
- npm run lint:ts
sass:lint:
image: node:7.10.0
stage: lint
script:
- npm run lint:sass
publish:
stage: publish
image: docker:latest
only:
- develop
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $REGISTRY_URL
script:
- docker build . -t "$IMAGE_NAME"
- docker push "$IMAGE_NAME"
deploy_dev:
stage: deploy
image: alpine:latest
environment:
name: dev
url: http://web.sik.party:8080
only:
- master
before_script:
- pwd
- apk add --update openssh
- ssh -V
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- scp docker-compose-frontend.yml $DEV_SSH_USER@$DEV_SSH_HOST:~/deployment/docker-compose-frontend.yml
- scp .deploy_dev-frontend.sh $DEV_SSH_USER@$DEV_SSH_HOST:~/deployment/deploy_dev-frontend.sh
- ssh $DEV_SSH_USER@$DEV_SSH_HOST "bash ~/deployment/deploy_dev-frontend.sh \"$IMAGE_NAME\""
# deploy_production:
# stage: deploy
# image: alpine:latest
# environment:
# name: production
# url: https://sika.sahkoinsinoorikilta.fi
# when: manual
# only:
# - master
# before_script:
# - pwd
# - apk add --update openssh
# - ssh -V
# - mkdir -p ~/.ssh
# - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa
# - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# script:
# - ssh $PROD_SSH_USER@$PROD_SSH_HOST "zsh ~/deploy-frontend.sh"