Merge pull request 'git-ci' (#29) from git-ci into master
Reviewed-on: http://git.plannaplan.pl/filipizydorczyk/backend/pulls/29
This commit is contained in:
commit
c1dce7d3bb
41
.gitlab-ci.yml
Normal file
41
.gitlab-ci.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
image: maven
|
||||||
|
script:
|
||||||
|
- echo "Start building App"
|
||||||
|
- rm -rf restservice/src/main/resources/application.properties
|
||||||
|
- echo "spring.profiles.active=prod" > restservice/src/main/resources/application.properties
|
||||||
|
- mvn clean
|
||||||
|
- mvn install
|
||||||
|
- cd restservice
|
||||||
|
- mvn clean package spring-boot:repackage
|
||||||
|
- echo "Build successfully!"
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 hour
|
||||||
|
paths:
|
||||||
|
- restservice/target/
|
||||||
|
|
||||||
|
deploy_production:
|
||||||
|
stage: deploy
|
||||||
|
before_script:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get --yes --force-yes install rsync
|
||||||
|
script:
|
||||||
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||||
|
- echo "Deploying to server"
|
||||||
|
- ssh backend@wmi-backend-gc.plannaplan.pl -t "sudo systemctl stop plannaplan-backend"
|
||||||
|
- ssh backend@wmi-backend-gc.plannaplan.pl -t "rm -rf /opt/plannaplan-backend/backend.jar"
|
||||||
|
- rsync --progress restservice/target/*.jar backend@wmi-backend-gc.plannaplan.pl:/opt/plannaplan-backend/backend.jar
|
||||||
|
- sleep 5
|
||||||
|
- ssh backend@wmi-backend-gc.plannaplan.pl -t "sudo systemctl start plannaplan-backend"
|
||||||
|
- echo "Deployed"
|
||||||
|
only:
|
||||||
|
- master
|
Loading…
Reference in New Issue
Block a user