Skip to content

Commit d47bbe3

Browse files
committed
try to get exact semver for {version} replacer
1 parent 8d696dc commit d47bbe3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ This versioning strategy allows for more granular control over the version of a
174174

175175
You can download release assets by using the `{release}/` placeholder in the file path.
176176

177-
Additionally, you can use the `{version}` placeholder to refer to the version of the dependency, without the trailing `v`. Here's an example:
177+
Additionally, you can use the `{version}` placeholder to refer to the semver version of the dependency, (without the trailing `v` or `-alpha` etc). Here's an example:
178178

179179
```json
180180
{

lib/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ export async function readableToFile(
9191
}
9292

9393
export function replaceVersion(path: string, version: string) {
94-
return path.replace('{version}', trimStartMatches(version, 'v'));
94+
return path.replace(
95+
'{version}',
96+
/\d+\.\d+\.\d+/.exec(version)?.[0] || trimStartMatches(version, 'v'),
97+
);
9598
}
9699

97100
export async function writeLockfile(

0 commit comments

Comments
 (0)