diff --git a/run b/run index 61a2239..6d0f010 100755 --- a/run +++ b/run @@ -92,16 +92,25 @@ function build-deb { # Set up environment dev-env - export DEBEMAIL="info@hatlabs.fi" - export DEBFULLNAME="Hat Labs CI" - export PACKAGE_VERSION=$(release-version) - DEB_VERSION=$(echo "$PACKAGE_VERSION" | sed 's/-\([a-zA-Z]\)/~\1/g') - - # Create a new changelog entry - dch --newversion "$DEB_VERSION" \ - --distribution stable \ - --force-distribution \ - "Automated release $PACKAGE_VERSION. See GitHub for details." + # Check if changelog was already generated by CI (shared-workflows) + # If debian/changelog exists and was modified in the last 5 minutes, skip regeneration + if [ -f "debian/changelog" ]; then + CHANGELOG_AGE=$(($(date +%s) - $(stat -c %Y debian/changelog 2>/dev/null || stat -f %m debian/changelog))) + if [ "$CHANGELOG_AGE" -lt 300 ]; then + echo "📋 Using existing debian/changelog (generated by CI)" + else + # Generate changelog for local builds + export DEBEMAIL="info@hatlabs.fi" + export DEBFULLNAME="Hat Labs CI" + export PACKAGE_VERSION=$(cat VERSION) + DEB_VERSION=$(echo "$PACKAGE_VERSION" | sed 's/-\([a-zA-Z]\)/~\1/g') + + dch --newversion "$DEB_VERSION" \ + --distribution stable \ + --force-distribution \ + "Automated release $PACKAGE_VERSION. See GitHub for details." + fi + fi dpkg-buildpackage -us -uc -b