Skip to content

Commit e7a9fe4

Browse files
committed
Remove suffix from
1 parent e31ccce commit e7a9fe4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

parse-release-tag/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
This action will take a release tag string as input and produce the following output:
44

55
1. `package-name`: the name of the package, if set.
6-
2. `package-version`: the version string that was published (10.9.8) or (8.9.10-alpha).
7-
3. `package-version-suffix`: the suffix part of the package-version.
6+
2. `package-version`: the version string (10.9.8).
7+
3. `package-version-suffix`: the prerelease suffix of the version tag
88
4. `prerelease`: set to `true` if a version suffix (`-<something>`) is appended to the tag.
99
```
1010
1111
For example, the tag "my-package-v42.0.0-alpha.1 would return:
1212
```
1313
package-name: "my-package",
14-
package-version: "42.0.0-alpha.1"
14+
package-version: "42.0.0"
1515
package-version-suffix: "-alpha.1"
1616
prerelease: true
1717
```

parse-release-tag/__tests__/tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("parseReleaseTag", () => {
1717
const parsedPrereleaseReleaseTag = parseReleaseTag(prereleaseReleaseTag);
1818
expect(parsedPrereleaseReleaseTag).deep.equal({
1919
packageName: "my-package",
20-
packageVersion: "1.0.0-alpha.1",
20+
packageVersion: "1.0.0",
2121
packageVersionSuffix: "-alpha.1",
2222
prerelease: true,
2323
});
@@ -35,7 +35,7 @@ describe("parseReleaseTag", () => {
3535
const parsedReleaseTagWithoutPackageWithSuffix = parseReleaseTag(releaseTagWithoutPackageWithSuffix);
3636
expect(parsedReleaseTagWithoutPackageWithSuffix).deep.equal({
3737
packageName: undefined,
38-
packageVersion: "1.0.0-alpha.1",
38+
packageVersion: "1.0.0",
3939
packageVersionSuffix: "-alpha.1",
4040
prerelease: true,
4141
});

parse-release-tag/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type ParsedReleaseTag = {
66
};
77

88
export function parseReleaseTag(releaseTag: string): ParsedReleaseTag {
9-
const releaseTagRegex = /(([a-zA-Z-]*[a-zA-Z])-)?v([0-9]+\.[0-9]+\.[0-9]+(-\S+)?)/;
9+
const releaseTagRegex = /(([a-zA-Z-]*[a-zA-Z])-)?v([0-9]+\.[0-9]+\.[0-9])+(-\S+)?/;
1010
const result = releaseTagRegex.exec(releaseTag);
1111
if (!result) {
1212
throw new Error(`Invalid release tag: ${releaseTag}`);

0 commit comments

Comments
 (0)