fix: Add dynamic versioning with build numbers to prevent duplicate package names
Some checks failed
Comprehensive CI/CD Pipeline / Build and Test (push) Failing after 6m44s
Comprehensive CI/CD Pipeline / Security Audit (push) Failing after 7s
Comprehensive CI/CD Pipeline / Package Validation (push) Successful in 3m35s
Comprehensive CI/CD Pipeline / Status Report (push) Has been skipped

- Update debian/changelog with CI build version before building
- Rename packages with build number and commit hash for uniqueness
- Format: apt-ostree_0.1.0+build{BUILD_NUMBER}.{COMMIT_HASH}_amd64.deb
- Prevents Forgejo upload conflicts with existing packages
- Each CI build now creates uniquely named packages

Resolves issue where Forgejo rejects duplicate filenames.
This commit is contained in:
joe 2025-08-15 15:21:42 -07:00
parent 7756305eab
commit d081296006

View file

@ -123,6 +123,14 @@ jobs:
if [ -f "debian/rules" ]; then
echo "✅ Using enhanced debian/rules for build"
# Update debian/changelog with build version
echo "apt-ostree ($BUILD_VERSION) unstable; urgency=medium" > debian/changelog
echo "" >> debian/changelog
echo " * CI Build #$BUILD_NUMBER from commit $COMMIT_HASH" >> debian/changelog
echo " * Automated build with enhanced Debian packaging" >> debian/changelog
echo "" >> debian/changelog
echo " -- CI Bot <ci@particle-os.org> $(date -R)" >> debian/changelog
# Set environment variables for enhanced build
export DH_VERBOSE=1
export DEB_BUILD_OPTIONS="parallel=$(nproc)"
@ -154,9 +162,28 @@ jobs:
if ls ../*.deb >/dev/null 2>&1; then
echo "✅ Debian package created successfully"
ls -la ../*.deb
# Copy packages to current directory for CI workflow
cp ../*.deb .
echo "✅ Packages copied to current directory"
# Rename packages with build version to ensure uniqueness
echo "Renaming packages with build version..."
for pkg in ../*.deb; do
pkg_name=$(basename "$pkg")
pkg_ext="${pkg_name##*.}"
pkg_base="${pkg_name%.*}"
# Extract current version and replace with build version
if [[ "$pkg_name" =~ ^apt-ostree_([^-]+)_([^.]+)\.deb$ ]]; then
current_version="${BASH_REMATCH[1]}"
arch="${BASH_REMATCH[2]}"
new_name="apt-ostree_${BUILD_VERSION}_${arch}.deb"
echo "Renaming: $pkg_name -> $new_name"
cp "$pkg" "$new_name"
else
# Fallback: just copy with original name
cp "$pkg" .
fi
done
echo "✅ Packages renamed and copied to current directory"
ls -la *.deb
else
echo "❌ No Debian package found"