Skip to content

Commit 668d708

Browse files
Copilot0xrinegade
andcommitted
Fix shutil.SameFileError in CI release workflow
Co-authored-by: 0xrinegade <[email protected]>
1 parent 5b112b3 commit 668d708

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,30 @@ jobs:
8888
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
8989
WORKDIR=$(pwd)
9090
PKG=osvm-$VERSION
91-
TARBALL="osvm_${VERSION}.orig.tar.gz" # Create tarball in current directory
91+
TARBALL="osvm_${VERSION}.orig.tar.gz"
92+
TEMP_TARBALL="temp_${TARBALL}" # Use temporary name to avoid same-file error
9293
# Clean up any old stuff
9394
rm -rf "$PKG"
94-
rm -f "$TARBALL"
95+
rm -f "$TARBALL" "$TEMP_TARBALL"
9596
# Prepare source dir
9697
mkdir -p "$PKG"
9798
cp -r src Cargo.toml Cargo.lock README.md LICENSE "$PKG/"
98-
# Pack source tarball in the current dir
99-
tar czvf "$TARBALL" "$PKG"
99+
# Pack source tarball with temporary name first
100+
tar czvf "$TEMP_TARBALL" "$PKG"
100101
# Ensure the tarball exists
101-
if [ ! -f "$TARBALL" ]; then
102-
echo "Error: $TARBALL not found!"
102+
if [ ! -f "$TEMP_TARBALL" ]; then
103+
echo "Error: $TEMP_TARBALL not found!"
103104
exit 1
104105
fi
105106
# Move into the package dir
106107
cd "$PKG"
107-
# Run dh_make using relative path to the tarball
108-
dh_make -y -s -c apache -e [email protected] -f "../$TARBALL"
108+
# Run dh_make using the temporary tarball - this avoids same-file error
109+
# dh_make will copy the temp tarball to the correct orig.tar.gz location
110+
dh_make -y -s -c apache -e [email protected] -f "../$TEMP_TARBALL"
109111
# Move back to the working dir
110112
cd "$WORKDIR"
113+
# Clean up temporary tarball
114+
rm -f "$TEMP_TARBALL"
111115
# Build the .deb package
112116
dpkg-buildpackage -us -uc
113117

0 commit comments

Comments
 (0)