Skip to content

feat: support LiquidJS templates in strategy properties#66

Merged
maff merged 2 commits into
mainfrom
feat/template-properties
Mar 15, 2026
Merged

feat: support LiquidJS templates in strategy properties#66
maff merged 2 commits into
mainfrom
feat/template-properties

Conversation

@maff
Copy link
Copy Markdown
Owner

@maff maff commented Mar 15, 2026

Summary

  • Property values are now rendered through the LiquidJS template engine with the same context available to version and tag templates
  • All three version result types (tagged, semVer, snapshot) support templated properties
  • Static string values continue to work unchanged

Example:

strategies:
  docker:
    properties:
      previousVersion: "{{ commitInfo.previousSemVerReleaseVersion }}"
      baseVersion: "{{ commitInfo.previousSemVerReleaseVersion | semver_inc: 'minor' }}"
      buildUrl: "{{ env.CI_JOB_URL }}"
      chartName: my-app  # static values still work

Test plan

  • CI passes
  • New tests cover template rendering in properties for tagged, semVer, and snapshot results
  • Static property values are unaffected

Closes #64

Property values are now rendered through the template engine with the
same context available to version and tag templates. This allows
properties like:

  properties:
    previousVersion: "{{ commitInfo.previousSemVerReleaseVersion }}"
    baseVersion: "{{ commitInfo.previousSemVerReleaseVersion | semver_inc: 'minor' }}"

Static string values continue to work as before.

Closes #64
Copilot AI review requested due to automatic review settings March 15, 2026 16:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds LiquidJS template rendering for strategy properties, aligning them with existing version/tag templating so users can compute output values from commitInfo, versionInfo, env, etc.

Changes:

  • Render StrategyConfig.properties values through LiquidJS for tagged, semVer, and snapshot version results.
  • Introduce helper to render properties with a shared template context per result type.
  • Add tests and documentation updates demonstrating templated properties.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/version/versionStrategy.ts Adds per-result template contexts and renders properties via LiquidJS before returning strategy results.
src/version/versionStrategy.test.ts Adds coverage ensuring properties render correctly for tagged/semVer/snapshot contexts and static values remain unchanged.
docs/templates.md Extends example to include a templated property.
docs/configuration.md Updates properties descriptions to note LiquidJS template support and link to templates docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 35 to 39
return {
version: tag,
tags: this.uniqueTags(this.config.tags.tagged, {
...this.templateContext(context, commitInfo),
version: tag,
}),
...this.config.properties,
tags: this.uniqueTags(this.config.tags.tagged, tplContext),
...this.renderProperties(tplContext),
};
Comment on lines 55 to 59
return {
version: stringVersion,
tags: this.uniqueTags(this.config.tags.semVer, {
...this.templateContext(context, commitInfo),
version: stringVersion,
semVer: version,
}),
...this.config.properties,
tags: this.uniqueTags(this.config.tags.semVer, tplContext),
...this.renderProperties(tplContext),
};
Comment on lines 115 to 119
return {
version: version,
tags: this.uniqueTags(this.config.tags.snapshot, {
...templateContext,
version,
prefix,
suffix,
branchIdentifier,
commitIdentifier,
}),
...this.config.properties,
tags: this.uniqueTags(this.config.tags.snapshot, snapshotTplContext),
...this.renderProperties(snapshotTplContext),
};
Comment thread src/version/versionStrategy.ts Outdated
Comment on lines +134 to +140
private renderProperties(context: any): Record<string, string> {
return Object.fromEntries(
Object.entries(this.config.properties).map(([key, value]) => [
key,
templateEngine.parseAndRenderSync(value, context),
]),
);
Properties are now spread before version/tags, so the canonical fields
always take precedence. Also tightens renderProperties context type
from any to Record<string, unknown>.
@maff maff merged commit 174ba9f into main Mar 15, 2026
6 checks passed
@maff maff deleted the feat/template-properties branch March 15, 2026 17:36
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.

feat: support LiquidJS templates in strategy properties

2 participants