This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inkletblot-com-v2/.gitlab-ci.yml

51 lines
1.5 KiB
YAML

stages:
- build
- deploy
develop-build-job:
stage: build
tags:
- build
- node
script:
- npm install
- npm run build
only:
- develop
master-build-job:
stage: build
tags:
- build
- node
script:
- npm install
- npm run build --prod
artifacts:
paths:
- dist/
only:
- master
deploy-job:
stage: deploy
tags:
- deploy
- node
when: manual
environment:
name: Production
url: "$Live_Server_IP"
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y)'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
script:
- tar zcf ../inkletblot-com.tar.gz ./dist
- scp -P "$Live_Server_Access_Port" -o StrictHostKeyChecking=no ../inkletblot-com.tar.gz "$Live_Server_User"@"$Live_Server_IP":/var/www/html
- ssh -p "$Live_Server_Access_Port" "$Live_Server_User"@"$Live_Server_IP" "rm -Rf /var/www/html/inkletblot-com_old && mv /var/www/html/inkletblot-com /var/www/html/inkletblot-com_old && mkdir /var/www/html/inkletblot-com_build && mkdir /var/www/html/inkletblot-com && tar zxf /var/www/html/inkletblot-com.tar.gz -C /var/www/html/inkletblot-com_build && mv /var/www/html/inkletblot-com_build/dist/inkletblot-com/* /var/www/html/inkletblot-com && rm -Rf /var/www/html/inkletblot-com_build && chmod -R 755 /var/www/html/inkletblot-com && exit"
only:
- master