Newer
Older
stages:
- build
- deploy
build:
image: git-r3lab.uni.lu:4567/r3/docker/nodejs-yarn-grunt
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "develop"
before_script:
- git config submodule.theme.url https://$CI_DEPLOY_USER:$CI_DEPLOY_PASSWORD@git-r3lab.uni.lu/R3-core/outreach/theme.git
- git submodule update --recursive --init
artifacts:
expire_in: 1 day
paths:
- public
production:
stage: deploy
image: alpine:3.1
before_script:
# define the branch
- if [[ $CI_COMMIT_BRANCH == "develop" ]]; then
elif [[ $CI_COMMIT_BRANCH == "master" ]]; then
- 'which ssh-agent || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
rules:
script:
- ssh -p $SSHPORT $SSHCONNECT "rm -rf ~/web/latest/*"
- ssh -p $SSHPORT $SSHCONNECT "mkdir ~/web/latest/$version"
- scp -P $SSHPORT -r public/* $SSHCONNECT:~/web/latest/$version