Skip to content

Commit

Permalink
Remove suffix from
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Jul 19, 2023
1 parent e31ccce commit e7a9fe4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions parse-release-tag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
This action will take a release tag string as input and produce the following output:

1. `package-name`: the name of the package, if set.
2. `package-version`: the version string that was published (10.9.8) or (8.9.10-alpha).
3. `package-version-suffix`: the suffix part of the package-version.
2. `package-version`: the version string (10.9.8).
3. `package-version-suffix`: the prerelease suffix of the version tag
4. `prerelease`: set to `true` if a version suffix (`-<something>`) is appended to the tag.
```
For example, the tag "my-package-v42.0.0-alpha.1 would return:
```
package-name: "my-package",
package-version: "42.0.0-alpha.1"
package-version: "42.0.0"
package-version-suffix: "-alpha.1"
prerelease: true
```
Expand Down
4 changes: 2 additions & 2 deletions parse-release-tag/__tests__/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("parseReleaseTag", () => {
const parsedPrereleaseReleaseTag = parseReleaseTag(prereleaseReleaseTag);
expect(parsedPrereleaseReleaseTag).deep.equal({
packageName: "my-package",
packageVersion: "1.0.0-alpha.1",
packageVersion: "1.0.0",
packageVersionSuffix: "-alpha.1",
prerelease: true,
});
Expand All @@ -35,7 +35,7 @@ describe("parseReleaseTag", () => {
const parsedReleaseTagWithoutPackageWithSuffix = parseReleaseTag(releaseTagWithoutPackageWithSuffix);
expect(parsedReleaseTagWithoutPackageWithSuffix).deep.equal({
packageName: undefined,
packageVersion: "1.0.0-alpha.1",
packageVersion: "1.0.0",
packageVersionSuffix: "-alpha.1",
prerelease: true,
});
Expand Down
2 changes: 1 addition & 1 deletion parse-release-tag/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type ParsedReleaseTag = {
};

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

0 comments on commit e7a9fe4

Please sign in to comment.