Pack Zip - BredaUniversityGames/JenkinsLib GitHub Wiki

zip.pack()

Creates a ZIP archive from a source directory. Works with any build system — no CPack configuration or install() rules required.

Usage

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()
}

Parameters

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

How It Works

  1. Resolves ${PARAM} placeholders in ZIP_SOURCE_DIR and ZIP_ARCHIVE_NAME against pipeline parameters (including matrix axis values)
  2. Verifies the source directory exists
  3. Creates a .zip archive in the workspace root using 7-Zip or PowerShell
  4. Sets ctx.outputDir to 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.

Troubleshooting

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)
⚠️ **GitHub.com Fallback** ⚠️