include:
  - project: 'infra/packages/ci-utils'
    ref: main
    file: 'shared-ci.yml'
  - local: 'gitlabci-version.yml'

variables:
  PACKAGE_NAME: nextcloud
  UPSTREAM_GITHUB_PATH: nextcloud/server

autoupdate:
  extends: .autoupdate:github:release-tags

.build:binary:
  extends: .build
  image: registry.git.cccv.de/infra/packages/docker-images/utility
  script:
  - wget -q "https://download.nextcloud.com/server/releases/nextcloud-${UPSTREAM_VERSION#v}.tar.bz2" -O nextcloud.tar.bz2
  - wget -q "https://download.nextcloud.com/server/releases/nextcloud-${UPSTREAM_VERSION#v}.tar.bz2.asc" -O nextcloud.tar.bz2.asc
  - ./gpg-verify.sh nextcloud.asc nextcloud.tar.bz2.asc nextcloud.tar.bz2
  - tar -xjf nextcloud.tar.bz2 # extracts everything to ./nextcloud
  artifacts:
    paths:
    - nextcloud

build:binary:bullseye:
  extends: .build:binary

package:apt:bullseye:
  extends: .package:apt
  dependencies:
  - build:binary:bullseye
  needs:
  - build:binary:bullseye

publish:apt:buster:
  extends: .publish:apt
  variables:
    APTLY_DISTRO: buster
    APTLY_ARCH: all
  dependencies:
  - package:apt:bullseye
  needs:
  - package:apt:bullseye

publish:apt:bullseye:
  extends: .publish:apt
  variables:
    APTLY_DISTRO: bullseye
    APTLY_ARCH: all
  dependencies:
  - package:apt:bullseye
  needs:
  - package:apt:bullseye
