Skip to content

Tool-cache not working with two-part version numbers #15

@mamogh

Description

@mamogh

Tool-cache not working with two-part version numbers

Problem

Tool-cache doesn't work with Advanced Installer versions like 22.9 because it expects semantic versioning format (major.minor.patch).

This causes slow builds due to unnecessary downloads.

Current behavior: Tool downloads every time instead of using cache, even when the tool is already in the cache folder:

Checking cache for advinst tool with version: 22.9
Tool not found in cache
Downloading advinst tool with version: 22.9
Extracting advinst tool

Expected behavior: Should not download if the tool is in the cache

Solution

Normalize version before calling tool-cache functions:

function normalizeVersion(version) {
  const parts = version.split('.');
  return parts.length === 2 ? `${version}.0` : version;
}

Working Fix

I've tested this in my fork and it works:

Checking cache for advinst tool with version: 22.9
Normalized version 22.9 to 22.9.0 for tool-cache compatibility
Tool found in cache
Registering advinst tool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions