Skip to content

Commit bc1a237

Browse files
committed
Fix release workflow YAML syntax
- Fixed PowerShell here-string issues in Windows packaging - Fixed bash heredoc issues in Linux/macOS packaging - Removed markdown headers that conflicted with YAML parsing - Updated release script to handle pre-set versions - All README generation now uses YAML-safe formats
1 parent 2713d5e commit bc1a237

2 files changed

Lines changed: 70 additions & 138 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -190,63 +190,25 @@ jobs:
190190
Copy-Item README.md, LICENSE "${PKG_DIR}/"
191191
192192
# Create README for the package
193-
@"
194-
# StreamLib Library v${VERSION} - Windows x64 (${{ matrix.config.name }})
195-
196-
This package contains the StreamLib library built for Windows x64.
197-
198-
## Contents
199-
200-
- ``include/`` - Header files
201-
- ``lib/`` - Library files (.lib)
202-
- ``bin/`` - DLL files (DLL build only)
203-
- ``examples/`` - Example source code
204-
- ``README.md`` - This file
205-
- ``LICENSE`` - License information
206-
207-
## Usage
208-
209-
### For DLL build:
210-
1. Add ``include/`` to your include path
211-
2. Add ``lib/`` to your library path
212-
3. Link against ``stream.lib``
213-
4. Add ``bin/`` to your PATH or copy DLLs to your application directory
214-
215-
### For static build:
216-
1. Add ``include/`` to your include path
217-
2. Add ``lib/`` to your library path
218-
3. Link against: stream.lib, zlib.lib, bz2.lib, lzma.lib, zstd.lib, archive.lib
219-
4. No runtime DLLs needed
220-
221-
## CMake Integration
222-
223-
``````cmake
224-
# Add include directory
225-
include_directories(path/to/streamlib/include)
226-
227-
# Link library
228-
target_link_libraries(your_target path/to/streamlib/lib/stream.lib)
229-
230-
# For static build, also link dependencies
231-
if(STATIC_BUILD)
232-
target_link_libraries(your_target
233-
path/to/streamlib/lib/zlib.lib
234-
path/to/streamlib/lib/bz2.lib
235-
path/to/streamlib/lib/lzma.lib
236-
path/to/streamlib/lib/zstd.lib
237-
path/to/streamlib/lib/archive.lib
238-
)
239-
endif()
240-
``````
241-
242-
## Version
243-
244-
StreamLib v${VERSION}
245-
Build type: ${{ matrix.config.name }}
246-
Platform: Windows x64
247-
248-
For more information, see the main README.md
249-
"@ | Out-File -FilePath "${PKG_DIR}/README.md" -Encoding UTF8
193+
$BUILD_TYPE = "${{ matrix.config.name }}"
194+
$readme = "${PKG_DIR}/README.md"
195+
"StreamLib Library v${VERSION} - Windows x64 (${BUILD_TYPE})" | Out-File -FilePath $readme -Encoding UTF8
196+
"===============================================================" | Out-File -FilePath $readme -Append -Encoding UTF8
197+
"" | Out-File -FilePath $readme -Append -Encoding UTF8
198+
"This package contains the StreamLib library built for Windows x64." | Out-File -FilePath $readme -Append -Encoding UTF8
199+
"" | Out-File -FilePath $readme -Append -Encoding UTF8
200+
"CONTENTS" | Out-File -FilePath $readme -Append -Encoding UTF8
201+
"--------" | Out-File -FilePath $readme -Append -Encoding UTF8
202+
"- include/ - Header files" | Out-File -FilePath $readme -Append -Encoding UTF8
203+
"- lib/ - Library files (.lib)" | Out-File -FilePath $readme -Append -Encoding UTF8
204+
"- bin/ - DLL files (DLL build only)" | Out-File -FilePath $readme -Append -Encoding UTF8
205+
"- examples/ - Example source code" | Out-File -FilePath $readme -Append -Encoding UTF8
206+
"" | Out-File -FilePath $readme -Append -Encoding UTF8
207+
"USAGE" | Out-File -FilePath $readme -Append -Encoding UTF8
208+
"For DLL build: Add include/ and lib/ to your paths, link against stream.lib" | Out-File -FilePath $readme -Append -Encoding UTF8
209+
"For static build: Link against stream.lib and all dependency .lib files" | Out-File -FilePath $readme -Append -Encoding UTF8
210+
"" | Out-File -FilePath $readme -Append -Encoding UTF8
211+
"VERSION: StreamLib v${VERSION} (${BUILD_TYPE}) - Windows x64" | Out-File -FilePath $readme -Append -Encoding UTF8
250212
251213
# Create archive
252214
Compress-Archive -Path "${PKG_DIR}" -DestinationPath "${PKG_DIR}.zip"
@@ -309,47 +271,30 @@ For more information, see the main README.md
309271
cp README.md LICENSE ${PKG_DIR}/
310272
311273
# Create README for package
312-
cat > ${PKG_DIR}/README.md << EOF
313-
# StreamLib Library v${VERSION} - Linux x64
314-
315-
This package contains the StreamLib static library built for Linux x64.
316-
317-
## Contents
274+
cat > ${PKG_DIR}/README.md << 'EOFREADME'
275+
StreamLib Library - Linux x64
276+
==============================
318277
319-
- \`include/\` - Header files
320-
- \`lib/\` - Static library (libstream.a)
321-
- \`examples/\` - Example source code
322-
- \`README.md\` - This file
323-
- \`LICENSE\` - License information
278+
CONTENTS
279+
--------
280+
- include/ - Header files
281+
- lib/ - Static library (libstream.a)
282+
- examples/ - Example source code
324283
325-
## Dependencies
284+
DEPENDENCIES
285+
------------
286+
This library requires: zlib, bzip2, liblzma, libzstd, libarchive
326287
327-
This library requires the following system libraries:
328-
- zlib
329-
- bzip2
330-
- liblzma
331-
- libzstd
332-
- libarchive
288+
Install on Ubuntu/Debian:
289+
sudo apt-get install zlib1g-dev libbz2-dev liblzma-dev libzstd-dev libarchive-dev
333290
334-
Install on Ubuntu/Debian:
335-
\`\`\`bash
336-
sudo apt-get install zlib1g-dev libbz2-dev liblzma-dev libzstd-dev libarchive-dev
337-
\`\`\`
291+
USAGE
292+
-----
293+
include_directories(/path/to/streamlib/include)
294+
target_link_libraries(your_target /path/to/streamlib/lib/libstream.a z bz2 lzma zstd archive)
338295
339-
## Usage
340-
341-
\`\`\`cmake
342-
include_directories(/path/to/streamlib/include)
343-
target_link_libraries(your_target /path/to/streamlib/lib/libstream.a z bz2 lzma zstd archive)
344-
\`\`\`
345-
346-
## Version
347-
348-
StreamLib v${VERSION}
349-
Platform: Linux x64
350-
351-
For more information, see the main README.md
352-
EOF
296+
For more information, see the main README.md
297+
EOFREADME
353298
354299
tar czf ${PKG_DIR}.tar.gz ${PKG_DIR}/
355300
@@ -404,47 +349,30 @@ EOF
404349
cp README.md LICENSE ${PKG_DIR}/
405350
406351
# Create README for package
407-
cat > ${PKG_DIR}/README.md << EOF
408-
# StreamLib Library v${VERSION} - macOS x64
409-
410-
This package contains the StreamLib static library built for macOS x64.
411-
412-
## Contents
413-
414-
- \`include/\` - Header files
415-
- \`lib/\` - Static library (libstream.a)
416-
- \`examples/\` - Example source code
417-
- \`README.md\` - This file
418-
- \`LICENSE\` - License information
419-
420-
## Dependencies
421-
422-
This library requires the following Homebrew libraries:
423-
- zlib
424-
- bzip2
425-
- xz
426-
- zstd
427-
- libarchive
428-
429-
Install with Homebrew:
430-
\`\`\`bash
431-
brew install zlib bzip2 xz zstd libarchive
432-
\`\`\`
433-
434-
## Usage
435-
436-
\`\`\`cmake
437-
include_directories(/path/to/streamlib/include)
438-
target_link_libraries(your_target /path/to/streamlib/lib/libstream.a z bz2 lzma zstd archive)
439-
\`\`\`
440-
441-
## Version
442-
443-
StreamLib v${VERSION}
444-
Platform: macOS x64
445-
446-
For more information, see the main README.md
447-
EOF
352+
cat > ${PKG_DIR}/README.md << 'EOFREADME'
353+
StreamLib Library - macOS x64
354+
==============================
355+
356+
CONTENTS
357+
--------
358+
- include/ - Header files
359+
- lib/ - Static library (libstream.a)
360+
- examples/ - Example source code
361+
362+
DEPENDENCIES
363+
------------
364+
This library requires: zlib, bzip2, xz, zstd, libarchive
365+
366+
Install with Homebrew:
367+
brew install zlib bzip2 xz zstd libarchive
368+
369+
USAGE
370+
-----
371+
include_directories(/path/to/streamlib/include)
372+
target_link_libraries(your_target /path/to/streamlib/lib/libstream.a z bz2 lzma zstd archive)
373+
374+
For more information, see the main README.md
375+
EOFREADME
448376
449377
tar czf ${PKG_DIR}.tar.gz ${PKG_DIR}/
450378

scripts/release.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,15 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
6363
exit 1
6464
fi
6565

66-
# Commit version change
66+
# Commit version change if needed
6767
echo
68-
echo "Committing version change..."
69-
git add CMakeLists.txt
70-
git commit -m "Release ${TAG}"
68+
if git diff --quiet CMakeLists.txt; then
69+
echo "Version already set to ${VERSION}, no commit needed."
70+
else
71+
echo "Committing version change..."
72+
git add CMakeLists.txt
73+
git commit -m "Release ${TAG}"
74+
fi
7175

7276
# Create tag
7377
echo

0 commit comments

Comments
 (0)