Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 16, 2025

Fixes asset paths with template variables not working with glob patterns (#867).

Problem

Asset paths containing template variables like ${nextRelease.version} were processed after glob pattern expansion, causing patterns like "release/my-project-v${nextRelease.version}*.zip" to fail. The glob would try to find files with literal ${nextRelease.version} in the filename before template substitution occurred.

Solution

This PR moves template expansion to occur before asset globbing by:

  1. Pre-processing all assets - Apply template substitution to asset paths before filtering and globbing
  2. Supporting all asset types - Handle string paths, object configurations, and array glob patterns
  3. Comprehensive templating - Apply templates to all relevant asset properties (path, url, label, type, filepath, target, status, packageName)
  4. Maintaining backward compatibility - Preserve existing functionality for non-templated assets

Example

This configuration now works correctly:

{
  assets: [
    "release/my-project-v${nextRelease.version}*.zip"
  ]
}

When nextRelease.version is "1.0.0", this expands to "release/my-project-v1.0.0*.zip" before globbing, correctly matching files like:

  • release/my-project-v1.0.0.zip
  • release/my-project-v1.0.0-alpha.zip
  • release/my-project-v1.0.0-beta.zip

Testing

  • Added new test case "Publish a release with templated wildcard path"
  • All existing tests continue to pass (137/137)
  • Code coverage maintained at 97.35%

This follows the same approach as originally implemented in #892.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: fgreinacher <1540469+fgreinacher@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] fix @semantic-release/gitlab/issues/867 following the same approach as @semantic-release/gitlab/pull/892 fix: allow templating asset glob patterns Sep 16, 2025
@Copilot Copilot AI requested a review from fgreinacher September 16, 2025 15:56
Copilot finished work on behalf of fgreinacher September 16, 2025 15:56
@fgreinacher fgreinacher marked this pull request as ready for review September 16, 2025 16:03
Copy link
Contributor

@fgreinacher fgreinacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JonasSchubert I have reviewed this, but please have another look in case I missed something 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants