mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Since the pipeline changed to use ucuntu22.04 runners, the nighty debian packages do not work on debian buster anymore.
This change updates the pipeline to build for Ubuntu 20.04 and 22.04 as well as for
Debian 10, 11 and 12.
The distribution specific apt sources are as follows:
"deb http://repo.aptly.info/nightly-bookworm bookworm main"
(replace bookworm with focal, buster, bullseye. Install aptly repo key with: curl -fsS https://www.aptly.info/pubkey.txt | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/aptly.gpg)
The builds on focal will also release to the legacy nightly apt repo: https://github.com/aptly-dev/aptly/actions/runs/8723898496/job/23933824692#step:7:24
This only affects nightly builds, for now.
Pipeline example: [](https://github.com/aptly-dev/aptly/actions/runs/8723898496)
115 lines
3.7 KiB
Bash
Executable File
115 lines
3.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
builds=build/
|
|
packages=${builds}*.deb
|
|
folder=`mktemp -u tmp.XXXXXXXXXXXXXXX`
|
|
aptly_user="$APTLY_USER"
|
|
aptly_password="$APTLY_PASSWORD"
|
|
aptly_api="https://aptly-ops.aptly.info"
|
|
version=`make version`
|
|
|
|
action=$1
|
|
dist=$2
|
|
|
|
usage() {
|
|
echo "Usage: $0 nighly jammy|focal|bookworm" >&2
|
|
echo " $0 release" >&2
|
|
}
|
|
|
|
if [ -z "$action" ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
if [ "action" = "nightly" ] && [ -z "$dist" ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
echo "Publishing version '$version' to $action for $dist...\n"
|
|
|
|
upload()
|
|
{
|
|
echo "\nUploading files:"
|
|
for file in $packages; do
|
|
echo " - $file"
|
|
curl -fsS -X POST -F "file=@$file" -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
|
|
done
|
|
echo
|
|
}
|
|
cleanup() {
|
|
echo "\nCleanup..."
|
|
curl -fsS -X DELETE -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
|
|
echo
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
if [ "$action" = "nightly" ]; then
|
|
if echo "$version" | grep -vq "+"; then
|
|
# skip nightly when on release tag
|
|
exit 0
|
|
fi
|
|
|
|
aptly_repository=aptly-nightly-$dist
|
|
aptly_published=s3:repo.aptly.info:nightly-$dist
|
|
|
|
upload
|
|
|
|
echo "\nAdding packages to $aptly_repository ..."
|
|
curl -fsS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
|
|
echo
|
|
|
|
echo "\nUpdating published repo $aptly_published ..."
|
|
curl -fsS -X PUT -H 'Content-Type: application/json' --data \
|
|
'{"AcquireByHash": true,
|
|
"Signing": {"Batch": true, "Keyring": "aptly.repo/aptly.pub", "secretKeyring": "aptly.repo/aptly.sec", "PassphraseFile": "aptly.repo/passphrase"}}' \
|
|
-u $aptly_user:$aptly_password ${aptly_api}/api/publish/$aptly_published/$dist
|
|
echo
|
|
|
|
if [ $dist = "focal" ]; then
|
|
echo "\nUpdating legacy nightly repo..."
|
|
|
|
aptly_repository=aptly-nightly
|
|
aptly_published=s3:repo.aptly.info:./nightly
|
|
|
|
upload
|
|
|
|
echo "\nAdding packages to $aptly_repository ..."
|
|
curl -fsS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
|
|
echo
|
|
|
|
echo "\nUpdating published repo $aptly_published ..."
|
|
curl -fsS -X PUT -H 'Content-Type: application/json' --data \
|
|
'{"AcquireByHash": true, "Signing": {"Batch": true, "Keyring": "aptly.repo/aptly.pub",
|
|
"secretKeyring": "aptly.repo/aptly.sec", "PassphraseFile": "aptly.repo/passphrase"}}' \
|
|
-u $aptly_user:$aptly_password ${aptly_api}/api/publish/$aptly_published
|
|
echo
|
|
fi
|
|
fi
|
|
|
|
if [ "$1" = "release" ]; then
|
|
aptly_repository=aptly-release
|
|
aptly_snapshot=aptly-$version
|
|
aptly_published=s3:repo.aptly.info:./squeeze
|
|
|
|
echo "\nAdding packages to $aptly_repository..."
|
|
curl -fsS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
|
|
echo
|
|
|
|
echo "\nCreating snapshot $aptly_snapshot from repo $aptly_repository..."
|
|
curl -fsS -X POST -u $aptly_user:$aptly_password -H 'Content-Type: application/json' --data \
|
|
"{\"Name\":\"$aptly_snapshot\"}" ${aptly_api}/api/repos/$aptly_repository/snapshots
|
|
echo
|
|
|
|
echo "\nSwitching published repo $aptly_published to use snapshot $aptly_snapshot..."
|
|
curl -fsS -X PUT -H 'Content-Type: application/json' --data \
|
|
"{\"AcquireByHash\": true, \"Snapshots\": [{\"Component\": \"main\", \"Name\": \"$aptly_snapshot\"}],
|
|
\"Signing\": {\"Batch\": true, \"Keyring\": \"aptly.repo/aptly.pub\",
|
|
\"secretKeyring\": \"aptly.repo/aptly.sec\", \"PassphraseFile\": \"aptly.repo/passphrase\"}}" \
|
|
-u $aptly_user:$aptly_password ${aptly_api}/api/publish/$aptly_published
|
|
echo
|
|
fi
|
|
|