63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
stages:
|
|
- build
|
|
- deploy
|
|
|
|
# Don't have develop yet hehe
|
|
# develop-build-job:
|
|
# stage: build
|
|
# tags:
|
|
# - hugo
|
|
# script:
|
|
# - echo "Building configuration"
|
|
# - hugo
|
|
# only:
|
|
# - develop
|
|
|
|
main-build-job:
|
|
stage: build
|
|
image: jojomi/hugo
|
|
tags:
|
|
- hugo
|
|
before_script:
|
|
- echo "Installing dart-sass-embedded"
|
|
- BIN_DIR=/bin
|
|
- DARTSASS_VERSION=1.49.9
|
|
- mkdir -p $BIN_DIR
|
|
- curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/${DARTSASS_VERSION}/sass_embedded-${DARTSASS_VERSION}-linux-x64.tar.gz;
|
|
- tar -xvf sass_embedded-${DARTSASS_VERSION}-linux-x64.tar.gz;
|
|
- mv sass_embedded/dart-sass-embedded $BIN_DIR
|
|
- rm -rf sass_embedded*;
|
|
- dart-sass-embedded --version
|
|
- echo "Installing hugo"
|
|
- apt intsall hugo
|
|
- hugo --version
|
|
script:
|
|
- echo "Building configuration"
|
|
- hugo
|
|
artifacts:
|
|
paths:
|
|
- public/
|
|
only:
|
|
- main
|
|
|
|
deploy-job:
|
|
stage: deploy
|
|
tags:
|
|
- hugo
|
|
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 ./public
|
|
- scp -o 'ProxyJump "$Live_Server_User"@"$Live_Server_IP"' -o StrictHostKeyChecking=no ../inkletblot-com.tar.gz "$Live_Server_User"@"$Live_Server_Target":/var/www/html
|
|
- ssh -J "$Live_Server_User"@"$Live_Server_IP" "$Live_Server_User"@"$Live_Server_Target" "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:
|
|
- main
|