Skip to content

Commit

Permalink
CI: Upload debs to pkg.gerbera.io
Browse files Browse the repository at this point in the history
  • Loading branch information
whyman committed Apr 10, 2024
1 parent fc1ebc6 commit 28b9cf6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 38 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/publish-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ jobs:
docker run \
--platform=${{ matrix.arch }} \
-e TZ=Etc/UTC \
-e ART_API_KEY=${{ secrets.ART_API_KEY }} \
-e DEB_UPLOAD_ACCESS_KEY_ID=${{ secrets.DEB_UPLOAD_ACCESS_KEY_ID }} \
-e DEB_UPLOAD_ENDPOINT=${{ secrets.DEB_UPLOAD_ENDPOINT }} \
-e DEB_UPLOAD_SECRET_ACCESS_KEY=${{ secrets.DEB_UPLOAD_SECRET_ACCESS_KEY }} \
-e PKG_SIGNING_KEY=${{ secrets.PKG_SIGNING_KEY }} \
-e PKG_SIGNING_KEY_ID=${{ secrets.PKG_SIGNING_KEY_ID }} \
-e GH_ACTIONS=y \
-v "$(pwd):/build" \
-w /build \
Expand Down
86 changes: 49 additions & 37 deletions scripts/debian/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,25 @@ function install-matroska() {
echo "::endgroup::"
}

function upload_to_artifactory() {

target_path="pool/main/g/gerbera/$deb_name"
bintray_url="https://gerbera.jfrog.io/artifactory/$1/$target_path;deb.distribution=$lsb_codename;deb.component=main;deb.architecture=$deb_arch"

printf "Uploading %s to %s...\n" "$target_path" "$bintray_url"

curl -H "X-JFrog-Art-Api:$ART_API_KEY" -XPUT -T "$deb_name" -uian@gerbera.io:"${ART_API_KEY}" "$bintray_url"
function upload_to_repo() {
echo "::group::Uploading package"
sudo apt-get install -y ruby gpg
sudo gem install deb-s3

echo "${PKG_SIGNING_KEY}" | gpg --import

deb-s3 upload \
--bucket=gerbera \
--prefix="${1}" \
--codename="${lsb_codename}" \
--arch="${deb_arch}" \
--lock \
--sign="${PKG_SIGNING_KEY_ID}" \
--access-key-id="${DEB_UPLOAD_ACCESS_KEY_ID}" \
--secret-access-key="${DEB_UPLOAD_SECRET_ACCESS_KEY}" \
--endpoint="${DEB_UPLOAD_ENDPOINT}" \
"${deb_name}"
echo "::endgroup::"
}

# Fix time issues
Expand All @@ -153,8 +164,6 @@ if [[ "${lsb_codename}" == "n/a" ]]; then
fi
lsb_distro=$(lsb_release -i --short)

install-gcc
install-cmake
my_sys=${lsb_codename}
my_upnp=pupnp
if [ $# -gt 0 ]; then
Expand Down Expand Up @@ -210,6 +219,9 @@ fi
if [[ ! -d build-deb ]]; then
mkdir build-deb

install-gcc
install-cmake

echo "::group::Installing dependencies"
sudo apt-get update
sudo apt-get install -y \
Expand All @@ -233,33 +245,33 @@ if [[ ! -d build-deb ]]; then
uuid-dev
sudo apt-get clean
echo "::endgroup::"
fi

if [[ "$lsb_codename" == "bionic" ]]; then
# dpkg-dev pulls g++ which changes your GCC symlinks because ubuntu knows better than you
sudo update-alternatives --set gcc /usr/bin/gcc-8
sudo update-alternatives --set cpp /usr/bin/cpp-8
fi
if [[ "$lsb_codename" == "bionic" ]]; then
# dpkg-dev pulls g++ which changes your GCC symlinks because ubuntu knows better than you
sudo update-alternatives --set gcc /usr/bin/gcc-8
sudo update-alternatives --set cpp /usr/bin/cpp-8
fi

if [[ "${my_sys}" == "HEAD" ]]; then
install-googletest
install-libexiv2 head
install-pugixml
install-duktape
if [[ "$lsb_codename" != "jammy" ]]; then
install-matroska
install-ffmpegthumbnailer
if [[ "${my_sys}" == "HEAD" ]]; then
install-googletest
install-libexiv2 head
install-pugixml
install-duktape
if [[ "$lsb_codename" != "jammy" ]]; then
install-matroska
install-ffmpegthumbnailer
fi
fi
fi

install-fmt
install-spdlog
install-taglib
if [[ "${my_upnp}" == "npupnp" ]]; then
install-npupnp
else
my_upnp="pupnp"
install-pupnp
install-fmt
install-spdlog
install-taglib
if [[ "${my_upnp}" == "npupnp" ]]; then
install-npupnp
else
my_upnp="pupnp"
install-pupnp
fi
fi

cd build-deb
Expand Down Expand Up @@ -303,13 +315,13 @@ fi

if [[ "${lsb_distro}" != "Raspbian" ]]; then
if [[ "${my_sys}" != "HEAD" ]]; then
if [[ "${ART_API_KEY:-}" ]]; then
if [[ "${DEB_UPLOAD_ENDPOINT:-}" ]]; then
# Tags only for main repo
[[ $is_tag == 1 ]] && upload_to_artifactory debian
[[ $is_tag == 1 ]] && upload_to_repo debian
# Git builds go to git
upload_to_artifactory debian-git
upload_to_repo debian-git
else
printf "Skipping upload due to missing ART_API_KEY"
printf "Skipping upload due to missing DEB_UPLOAD_ENDPOINT"
fi
else
ctest --output-on-failure
Expand Down

0 comments on commit 28b9cf6

Please sign in to comment.