fix: Add dynamic versioning with build numbers to prevent duplicate package names
- 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:
parent
b4fa6fe1c2
commit
f48d34a79f
1 changed files with 30 additions and 3 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue