| 1 | # BlueGit CI (vertaald uit .gitlab-ci.yml; GitLab is alleen nog backup). |
| 2 | # Secrets (repo, beschermd, gekopieerd van GitLab): timftphost, timftpuser, timftppassword, timftproot, projectftp. |
| 3 | stages: [test, deploy] |
| 4 | |
| 5 | php_syntax_check: |
| 6 | stage: test |
| 7 | image: php:latest |
| 8 | script: |
| 9 | - echo "Checking PHP syntax..." |
| 10 | - find . -name "*.php" -print0 | xargs -0 -n1 php -l |
| 11 | |
| 12 | ftp_upload: |
| 13 | stage: deploy |
| 14 | image: debian:bookworm-slim |
| 15 | needs: [php_syntax_check] |
| 16 | resource_group: production |
| 17 | rules: |
| 18 | - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event" |
| 19 | script: |
| 20 | - apt-get update -qy |
| 21 | - apt-get install -y --no-install-recommends lftp python3 ca-certificates |
| 22 | # BlueGit expandeert $timftproot in secrets niet (GitLab deed dat wel). |
| 23 | - export projectftp="$(python3 -c 'import os;r=os.environ.get("timftproot","");print(os.environ["projectftp"].replace("${timftproot}",r).replace("$timftproot",r))')" |
| 24 | - test -n "$projectftp" |
| 25 | # Zelfde commando's als op GitLab: cd naar de projectmap, mirror met --delete, data/** blijft staan. |
| 26 | - 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" |