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 🙇

@fgreinacher fgreinacher merged commit 2389427 into master Oct 1, 2025
14 checks passed
@fgreinacher fgreinacher deleted the copilot/fix-8c22abad-bbfd-4385-a282-6d13ea3eca70 branch October 1, 2025 08:46
Copy link

github-actions bot commented Oct 1, 2025

🎉 This PR is included in version 13.2.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants