#!/usr/bin/env bash project="ppom/reaction" encoded_project=$(echo -n "$project" | jq -sRr @uri) api_url="https://framagit.org/api/v4/projects/$encoded_project/releases" # Get latest release tag api=$(curl --silent "$api_url") new=$(echo "$api" | jq -r '.[0].tag_name' | sed 's/^v//') # Get current version from APT repo current=$(reprepro -b /var/www/repos/apt/debian list stable reaction | head -n1 | awk '{print substr($3,1,length($3))}') # Define suffixes all_suffix=('amd64.deb' 'arm64.deb') if [ "$current" != "${new}-1" ]; then echo "New REACTION version detected: $current -> $new" for suffix in "${all_suffix[@]}"; do deb_url=$(echo "$api" | jq -r ".[0].assets.links[] | select(.name | endswith(\"$suffix\")) | .url") path="/tmp/reaction.deb" wget -q $deb_url -O $path reprepro -b /var/www/repos/apt/debian -S net includedeb stable $path reprepro -b /var/www/repos/apt/debian -S net includedeb oldstable $path rm $path done fi