Skip to content

Commit 76fb253

Browse files
committed
correct release pineline error on windows
1 parent f58bac4 commit 76fb253

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,24 +181,28 @@ jobs:
181181
version="${{ needs.validate-release.outputs.version }}"
182182
archive_name="trlc-platform-$version-source"
183183
184-
# Create source archive excluding build artifacts and git
185-
if [ "${{ matrix.archive }}" = "zip" ]; then
186-
# Windows - create ZIP
187-
powershell -Command "Compress-Archive -Path . -DestinationPath $archive_name.zip -Exclude build,.git,.cache,*.zip,*.tar.gz"
184+
# Create clean source copy first
185+
mkdir src-archive-tmp
186+
187+
# Copy files excluding build artifacts and git
188+
if [ "${{ runner.os }}" = "Windows" ]; then
189+
# Windows: Use robocopy for selective copy
190+
robocopy . src-archive-tmp /E /XD build .git .cache /XF "*.zip" "*.tar.gz" || true
191+
cd src-archive-tmp && powershell -Command "Compress-Archive -Path * -DestinationPath '../$archive_name.zip'" && cd ..
188192
else
189193
# Linux/macOS - create tar.gz
190-
# Copy source to a new directory to avoid archiving changing files
191-
mkdir src-archive-tmp
192194
if command -v rsync >/dev/null 2>&1; then
193195
rsync -av --exclude build --exclude .git --exclude .cache --exclude '*.zip' --exclude '*.tar.gz' ./ src-archive-tmp/
194196
else
195197
cp -r . src-archive-tmp/
196198
rm -rf src-archive-tmp/build src-archive-tmp/.git src-archive-tmp/.cache
197-
find src-archive-tmp/ -name "*.zip" -o -name "*.tar.gz" -delete
199+
find src-archive-tmp/ -name "*.zip" -o -name "*.tar.gz" -delete 2>/dev/null || true
198200
fi
199201
tar -czf "$archive_name.tar.gz" -C src-archive-tmp .
200-
rm -rf src-archive-tmp
201202
fi
203+
204+
# Cleanup
205+
rm -rf src-archive-tmp
202206
203207
- name: Create header-only package
204208
shell: bash
@@ -209,13 +213,13 @@ jobs:
209213
# Create header-only package
210214
mkdir -p "$headers_name"
211215
if [ -d "include" ]; then
212-
cp -r include/* "$headers_name/"
216+
cp -r include/* "$headers_name/" 2>/dev/null || true
213217
fi
214218
[ -f "README.md" ] && cp "README.md" "$headers_name/" || true
215219
[ -f "LICENSE" ] && cp "LICENSE" "$headers_name/" || true
216220
217221
if [ "${{ matrix.archive }}" = "zip" ]; then
218-
powershell -Command "Compress-Archive -Path '$headers_name' -DestinationPath '$headers_name.zip'"
222+
cd "$headers_name" && powershell -Command "Compress-Archive -Path * -DestinationPath '../$headers_name.zip'" && cd ..
219223
else
220224
tar -czf "$headers_name.tar.gz" "$headers_name"
221225
fi

0 commit comments

Comments
 (0)