# Build on Bookworm
default:
  image: debian:bookworm

latest:
  # Build the latest .deb file
  stage: build
  tags: [ docker ]
  script:
    - apt update && apt install -y build-essential fakeroot devscripts apache2-dev
    - export DEBEMAIL="NOREPLY@`hostname -d`"
    - mkdir -p builddir
    - uscan --overwrite-download --destdir builddir
    - cd ../nextcloud-server-29.0.5
    - dpkg-buildpackage -rfakeroot
    - cd - ; cp ../nextcloud-server_*.deb .
  artifacts:
    paths:
      - '*.deb'

up_to_date:
  # This job will succeed if we are up to date and fail if there is a later
  # version of Nextcloud that we don't know about. The failure may result in
  # emails going out to the maintainers so they quickly know about the need
  # to update the package (adding any dependencies, etc.)
  stage: build
  tags: [ docker ]
  script:
    - apt update && apt install -y devscripts
    - rc=0
    - uscan --no-download || rc=$?
    - if [ $rc -eq 0 ]; then echo "Newer version available"; exit 1; fi