Pack Zip - BredaUniversityGames/JenkinsLib GitHub Wiki
Creates a ZIP archive from a source directory. Works with any build system — no CPack configuration or install() rules required.
stages {
git.sync()
cmake.build()
zip.pack(ZIP_SOURCE_DIR: 'build/${CMAKE_BUILD_PRESET}/bin/game')
github.release()
}Inside a matrix:
stages {
git.sync()
matrix(CMAKE_BUILD_PRESET: ['Developer-Packaging', 'Release-Game']) {
cmake.build()
zip.pack(ZIP_SOURCE_DIR: 'build/${CMAKE_BUILD_PRESET}/bin/game')
}
github.release()
}| Parameter | Default | Description |
|---|---|---|
ZIP_SOURCE_DIR |
(required) | Directory to archive. Supports ${PARAM} placeholders resolved from pipeline parameters |
ZIP_ARCHIVE_NAME |
(source dir name) | Output filename without .zip extension. Supports ${PARAM} placeholders |
- Resolves
${PARAM}placeholders inZIP_SOURCE_DIRandZIP_ARCHIVE_NAMEagainst pipeline parameters (including matrix axis values) - Verifies the source directory exists
- Creates a
.ziparchive in the workspace root using 7-Zip or PowerShell - Sets
ctx.outputDirto the archive path
The archive is placed in the workspace root so deploy modules like github.release() (with GH_RELEASE_ASSETS = '*.zip') can find it.
| Issue | Solution |
|---|---|
| "source directory does not exist" | Check that the ZIP_SOURCE_DIR path is correct and that a build stage ran first |
github.release() can't find the zip |
Ensure GH_RELEASE_ASSETS glob matches the archive name (default *.zip works) |