| 1 |
#!/usr/bin/env bash |
| 2 |
# SPDX-License-Identifier: CC0-1.0 |
| 3 |
# SPDX-FileCopyrightText: 2018-2024 Collabora, Ltd. and the Monado contributors |
| 4 |
|
| 5 |
{# ignore the warning, this is actually the template to edit. #} |
| 6 |
############################################### |
| 7 |
# GENERATED - DO NOT EDIT # |
| 8 |
# see .gitlab-ci/reprepro.sh.template instead # |
| 9 |
############################################### |
| 10 |
{# |
| 11 |
Please run the following after editing: |
| 12 |
ci-fairy generate-template --config .gitlab-ci/config.yml .gitlab-ci/reprepro.sh.template > .gitlab-ci/reprepro.sh |
| 13 |
#} |
| 14 |
|
| 15 |
|
| 16 |
set -euo pipefail |
| 17 |
|
| 18 |
# Convince gnupg to work properly in CI |
| 19 |
echo "Import and cache the GPG key" |
| 20 |
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg |
| 21 |
cp .gitlab-ci/gpg.conf .gitlab-ci/gpg-agent.conf ~/.gnupg |
| 22 |
echo RELOADAGENT | gpg-connect-agent |
| 23 |
gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase "${MONADO_GPG_PASSPHRASE}" --import "${MONADO_GPG_SECRET_KEY}" |
| 24 |
|
| 25 |
echo "Prepare reprepro config" |
| 26 |
mkdir -p repo/conf |
| 27 |
# Substitute in the GPG fingerprint into the repository config. |
| 28 |
# This file is itself generated with ci-fairy. |
| 29 |
cat .gitlab-ci/distributions | envsubst > repo/conf/distributions |
| 30 |
|
| 31 |
echo "reprepro config file:" |
| 32 |
echo "---------------------" |
| 33 |
cat repo/conf/distributions |
| 34 |
echo "---------------------" |
| 35 |
|
| 36 |
# For each distro, sign the changes file and add it to the repo. |
| 37 |
{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %} |
| 38 |
|
| 39 |
# {{ image.codename }} |
| 40 |
if [ -f "incoming/{{image.codename}}.distro" ]; then |
| 41 |
VERSION=$(cat incoming/{{image.codename}}.distro) |
| 42 |
echo "Signing and processing {{image.codename}}: ${VERSION}" |
| 43 |
debsign -k "${MONADO_GPG_FINGERPRINT}" -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" "incoming/monado_${VERSION}_amd64.changes" |
| 44 |
reprepro -V --ignore=wrongdistribution -b repo include {{image.codename}} "incoming/monado_${VERSION}_amd64.changes" |
| 45 |
else |
| 46 |
echo "Skipping {{image.codename}} - no artifact found" |
| 47 |
fi |
| 48 |
{% endfor -%} {%- endfor %} |