61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
stages:
|
|
- build
|
|
- deploy
|
|
|
|
variables:
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
|
|
build:
|
|
stage: build
|
|
image: python:alpine3.18
|
|
script:
|
|
- apk add build-base python3-dev
|
|
- pip3 install -r requirements.txt
|
|
- pelican --version
|
|
- env TZ=Europe/Rome pelican ./content/ --ignore-cache -o public/ -s publishconf.py -v
|
|
- echo -e "commit=${CI_COMMIT_SHA}\nbuildDate=$(date -Iseconds)\n" > public/buildinfo.txt
|
|
- find public -type f
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
|
|
|
|
|
|
.deploys:
|
|
needs: ["build"]
|
|
variables:
|
|
GIT_STRATEGY: none
|
|
stage: deploy
|
|
|
|
|
|
|
|
deploy-testing:
|
|
extends: .deploys
|
|
image: amd64/debian:bullseye
|
|
before_script:
|
|
- mkdir -p ~/.ssh
|
|
- apt-get update -qq && apt-get install -y -qq rsync openssh-client
|
|
- cp ${TESTDEPLOY_SSH_PRIVATE_KEY} ~/.ssh/id_ed25519
|
|
- chmod 600 ~/.ssh/id_ed25519
|
|
script:
|
|
- rsync -avz -e "ssh -o StrictHostKeyChecking=no -p ${TESTDEPLOY_PORT} -i ~/.ssh/id_ed25519" public/ ${TESTDEPLOY_USERNAME}@"${TESTDEPLOY_SERVER}":${TESTDEPLOY_PATH}${CI_COMMIT_BRANCH:-}
|
|
|
|
|
|
|
|
# deploy-production:
|
|
# extends: .deploys
|
|
# only:
|
|
# - master
|
|
# image: tubia/webdav-upload
|
|
# script:
|
|
# - webdav-upload --verbose --user="$WEBDAV_USER" --password="$WEBDAV_PASSWORD" --url "${WEBDAV_HOST}/${WEBDAV_USER}/" public $WEBDAV_HOST_FOLDER
|
|
|
|
deploy-production:
|
|
extends: .deploys
|
|
only:
|
|
- master
|
|
image:
|
|
name: rclone/rclone:latest
|
|
entrypoint: [""]
|
|
script:
|
|
- "rclone sync -P -v -u --webdav-url ${WEBDAV_HOST}/${WEBDAV_USER}/ --webdav-user ${WEBDAV_USER} --webdav-pass $(echo -n \"${WEBDAV_PASSWORD}\" | rclone obscure -) ./public/ :webdav:${WEBDAV_HOST_FOLDER}/"
|