Skip to content

Commit 8bbd3c7

Browse files
committed
Fix custom keyring path when mirroring repo
1 parent 69c8596 commit 8bbd3c7

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ jobs:
6868
GITHUB_TOKEN: ${{ secrets.CLI_RELEASE }}
6969
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
7070
- name: Publish packages to APT repo
71-
if: contains(github.ref_name, '-') == false
7271
env:
7372
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
74-
GPG_PRIVATE_KEY_ID: ${{ steps.import_gpg.outputs.keyid }}
73+
GPG_PRIVATE_KEY_ID: ${{ steps.import_gpg.outputs.fingerprint }}
7574
run: ./scripts/publish-apt-packages.sh

public.asc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
3+
mDMEZecIDBYJKwYBBAHaRw8BAQdAkJdEvuTh7E95zz3bwKLNSn7CiYrKSK0rjy8Y
4+
DBTIqYq0NVNUQUNLSVQgR1BHIFNJR05FUiA8c3RhY2tpdC1ncGctc2lnbmVyQHN0
5+
YWNraXQuY2xvdWQ+iJkEExYKAEEWIQSdnh7Gtp/l8z02ElhB2Hp1SygX/gUCZecI
6+
DAIbAwUJAO1OAAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAKCRBB2Hp1SygX
7+
/vKZAP9s/T0F4A/4urNq6SoJGK2cbFUr/N5ReuIns3uDugFF2QEA8RtIeZmDcrZe
8+
gIYLYXxdmnWE9a0c40VO/VMJWer0kwu4OARl5wgMEgorBgEEAZdVAQUBAQdAsMmj
9+
G7eHWlL1M0cBYDKD4wY0ho+moixXDJj71hVEHXEDAQgHiH4EGBYKACYWIQSdnh7G
10+
tp/l8z02ElhB2Hp1SygX/gUCZecIDAIbDAUJAO1OAAAKCRBB2Hp1SygX/ksfAP9F
11+
D5HVH5qcAYI5+7gwhQWjwKQCTIDGE4z7frTnt6NB/QEAheahd+Rv/N9KSJsjyesU
12+
CBXspQZQZZkRaS79frnnkAQ=
13+
=1WMx
14+
-----END PGP PUBLIC KEY BLOCK-----

scripts/publish-apt-packages.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ OBJECT_STORAGE_ENDPOINT="https://object.storage.eu01.onstackit.cloud"
1010
APT_BUCKET_NAME="stackit-cli-apt"
1111
PUBLIC_KEY_BUCKET_NAME="stackit-public-key"
1212
PUBLIC_KEY_FILE="key.gpg"
13-
CUSTOM_KEYRING="custom-keyring"
13+
CUSTOM_KEYRING_FILE="aptly-keyring.gpg"
1414
DISTRIBUTION="stackit"
1515
APTLY_CONFIG_FILE_PATH="./.aptly.conf"
1616
GORELEASER_PACKAGES_FOLDER="dist/"
1717

18+
# We need to disable the key database daemon (keyboxd)
19+
# This can be done by removing "use-keyboxd" from ~/.gnupg/common.conf (see https://github.com/gpg/gnupg/blob/master/README)
20+
echo -n >~/.gnupg/common.conf
21+
1822
# Create a local mirror of the current state of the remote APT repository
1923
printf ">>> Creating mirror \n"
2024
curl ${OBJECT_STORAGE_ENDPOINT}/${PUBLIC_KEY_BUCKET_NAME}/${PUBLIC_KEY_FILE} >public.asc
21-
gpg --no-default-keyring --keyring ./${CUSTOM_KEYRING}.gpg --import public.asc
22-
aptly mirror create -keyring="${CUSTOM_KEYRING}.gpg" current "${OBJECT_STORAGE_ENDPOINT}/${APT_BUCKET_NAME}" ${DISTRIBUTION}
25+
gpg -v --no-default-keyring --keyring=${CUSTOM_KEYRING_FILE} --import public.asc
26+
aptly mirror create -config "${APTLY_CONFIG_FILE_PATH}" -keyring="${CUSTOM_KEYRING_FILE}" current "${OBJECT_STORAGE_ENDPOINT}/${APT_BUCKET_NAME}" ${DISTRIBUTION}
2327

2428
# Update the mirror to the latest state
2529
printf "\n>>> Updating mirror \n"
26-
aptly mirror update current
30+
aptly mirror update -keyring="${CUSTOM_KEYRING_FILE}" current
2731

2832
# Create a snapshot of the mirror
2933
printf "\n>>> Creating snapshop from mirror \n"
@@ -47,4 +51,4 @@ aptly snapshot pull -no-remove -architectures="amd64,i386,arm64" current-snapsho
4751

4852
# Publish the new snapshot to the remote repo
4953
printf "\n>>> Publishing updated snapshot \n"
50-
aptly publish switch -gpg-key="${GPG_PRIVATE_KEY_ID}" -passphrase "${GPG_PASSPHRASE}" -config "${APTLY_CONFIG_FILE_PATH}" ${DISTRIBUTION} "s3:${APT_BUCKET_NAME}:" updated-snapshot
54+
aptly publish snapshot -keyring="${CUSTOM_KEYRING_FILE}" -gpg-key="${GPG_PRIVATE_KEY_ID}" -passphrase "${GPG_PASSPHRASE}" -config "${APTLY_CONFIG_FILE_PATH}" updated-snapshot "s3:${APT_BUCKET_NAME}:"

0 commit comments

Comments
 (0)