# BlueGit CI (vertaald uit .gitlab-ci.yml; GitLab is alleen nog backup).
# Secrets (repo, beschermd, gekopieerd van GitLab): timftphost, timftpuser, timftppassword, timftproot, projectftp.
stages: [test, deploy]
php_syntax_check:
stage: test
image: php:latest
script:
- echo "Checking PHP syntax..."
- find . -name "*.php" -print0 | xargs -0 -n1 php -l
ftp_upload:
stage: deploy
image: debian:bookworm-slim
needs: [php_syntax_check]
resource_group: production
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
script:
- apt-get update -qy
- apt-get install -y --no-install-recommends lftp python3 ca-certificates
# BlueGit expandeert $timftproot in secrets niet (GitLab deed dat wel).
- export projectftp="$(python3 -c 'import os;r=os.environ.get("timftproot","");print(os.environ["projectftp"].replace("${timftproot}",r).replace("$timftproot",r))')"
- test -n "$projectftp"
# Zelfde commando's als op GitLab: cd naar de projectmap, mirror met --delete, data/** blijft staan.
- printf 'set ssl:verify-certificate no\nset sftp:auto-confirm yes\nset cmd:fail-exit yes\ncd "%s"\nmirror -R --delete --exclude-glob data/** ./web .\nbye\n' "$projectftp" | lftp -u "$timftpuser","$timftppassword" "$timftphost"