Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.04 KiB
Newer Older
Julian's avatar
Julian committed
include:
  - project: 'infra/packages/ci-utils'
    ref: main
    file: 'shared-ci.yml'

variables:
  # We don't set PACKAGE_NAME since we build many different packages,
  # therefore we must overwrite APT_REPO.
  APT_REPO: infrapackages-dokuwiki

autoupdate:
  stage: autoupdate
  rules:
  - if: '$RUN_AUTOUPDATE == "1"'
    when: always
  dependencies: []
  needs: []
  script:
  - mkdir -p ~/.ssh && chmod 0700 ~/.ssh && echo "$SSH_DEPLOY_KEY" > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
  - echo "$SSH_HOST_KEY" > ~/.ssh/known_hosts
  - git clone "git@${CI_SERVER_SHELL_SSH_HOST}:${CI_PROJECT_PATH}.git" autoupdate-checkout
Julian's avatar
Julian committed
  - |
    set -e 
    cd autoupdate-checkout
    git config --global user.email "infra+packages-autoupdate@cccv.de"
    git config --global user.name "autoupdater"
    mkdir ../tmp
    grep -E '^[^#]+' config/plugins | while read -r plugin_name plugin_url; do
      plugin_path="$(pwd)/tmp/${plugin_name}"
      git clone --depth 1 "${plugin_url}" "${plugin_path}"
      plugin_version="$(git -C "${plugin_path}" show -s --date='format:%Y%m%d' --format='0.0.%cd+git%h' HEAD)"
      tag_name="release/${plugin_name}/${plugin_version}"
      tag_filter="release/${plugin_name}/${plugin_version%+*}+*"
      if [ "$(git tag -l "$tag_filter")" == "" ]; then
        git tag "${tag_name}"
        git push --tags
      fi
    done

package:apt:bullseye:
  stage: package
  rules:
  - if: '$RUN_AUTOUPDATE != "1" && $CI_COMMIT_TAG =~ /^release\//'
  script:
  - ./scripts/prepare_package.sh "${CI_COMMIT_TAG#release/}"
  - dpkg-buildpackage -us -uc
  - mv ../*.deb ./
  - dpkg-deb -I *.deb
  - dpkg-deb -c *.deb > contents.txt
  artifacts:
    paths:
    - ./*.deb
    - debian
    - contents.txt

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