Merge branch 'gitlab-ci' into 'dev'

Gitlab ci

See merge request chameleon-vision/Chameleon-Vision!29
This commit is contained in:
ori agranat
2019-11-09 10:52:55 +00:00

50
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,50 @@
stages:
- build_ui
- build_jar
- deploy
build_ui:
stage: build_ui
image: node:latest
only:
refs:
- master
script:
- cd chameleon-client
- npm install
- npm run build
artifacts:
paths:
- chameleon-client/dist
build_jar:
stage: build_jar
image: maven:3.6.2-jdk-12
only:
refs:
- master
script:
- rm -r Main/src/main/resources/web/*
- mv chameleon-client/dist/* Main/src/main/resources/web
- cd Main
- mvn package
artifacts:
paths:
- Main/target
deploy:
stage: deploy
image: ubuntu:latest
only:
refs:
- master
before_script:
- apt-get update
- apt-get --yes install git ssh rsync
- git submodule update --init --recursive
script:
- mkdir "${HOME}/.ssh"
- echo "${SSH_HOST_KEY}" > "${HOME}/.ssh/known_hosts"
- echo "${SSH_PRIVATE_KEY}" > "${HOME}/.ssh/id_rsa"
- chmod 700 "${HOME}/.ssh/id_rsa"
- cd Main/target
- rsync -e "ssh -o StrictHostKeyChecking=no" $(find . -name "chameleon-vision-*") "${SSH_HOST_ADRESS}"