Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ruby): support ruby alpha format #2447

Merged
merged 4 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions scripts/release/__tests__/createReleasePR.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ describe('createReleasePR', () => {
},

ruby: {
current: '0.0.1',
current: '3.0.0.alpha.0',
releaseType: null,
skipRelease: true,
next: getNextVersion('0.0.1', null),
next: getNextVersion('3.0.0.alpha.0', 'minor'),
},

scala: {
Expand All @@ -381,25 +381,25 @@ describe('createReleasePR', () => {
},
})
).toMatchInlineSnapshot(`
"- javascript: 0.0.1 -> **\`patch\` _(e.g. 0.0.2)_**
- ~java: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- php: 0.0.1 -> **\`minor\` _(e.g. 0.1.0)_**
- ~go: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~kotlin: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~dart: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~python: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~ruby: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~scala: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~csharp: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default."
`);
"- javascript: 0.0.1 -> **\`patch\` _(e.g. 0.0.2)_**
- ~java: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- php: 0.0.1 -> **\`minor\` _(e.g. 0.1.0)_**
- ~go: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~kotlin: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~dart: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~python: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~ruby: 3.0.0.alpha.0 -> **\`null\` _(e.g. 3.0.0.alpha.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~scala: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default.
- ~csharp: 0.0.1 -> **\`null\` _(e.g. 0.0.1)_**~
- No \`feat\` or \`fix\` commit, thus unchecked by default."
`);
});
});

Expand Down
1 change: 1 addition & 0 deletions scripts/release/__tests__/updateAPIVersions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ describe('getNextVersion', () => {
expect(getNextVersion('4.0.0a1', 'minor')).toEqual('4.0.0a2');
expect(getNextVersion('4.0.0a12', 'minor')).toEqual('4.0.0a13');
expect(getNextVersion('4.0.0a99', 'minor')).toEqual('4.0.0a100');
expect(getNextVersion('3.0.0.alpha.0', 'minor')).toEqual('3.0.0.alpha.1');
});
});
2 changes: 1 addition & 1 deletion scripts/release/createReleasePR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function getNextVersion(current: string, releaseType: semver.ReleaseType
// python alpha releases have a pattern like X.Y.ZaN
// where a means alpha and N can be any digit representing the alpha version
// see https://peps.python.org/pep-0440/
Comment on lines 179 to 181
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this comment not related anymore?

Copy link
Member

Choose a reason for hiding this comment

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

It can be expanded to ruby indeed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's still relevant for python, but also support ruby now, I can add a small com

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe remove it? I feel like the regex is self explanatory 😁
It's true we could document every language specificity to know why the regex get more complex each time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hopefully we won't stumble across new version format ! this should support everything

Copy link
Collaborator Author

@millotp millotp Dec 28, 2023

Choose a reason for hiding this comment

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

quoi que, ruby has 2.0.0.pre.alpha.2

if (releaseType !== 'major' && /\d\.\d\.\da\d+$/.test(current)) {
if (releaseType !== 'major' && /\d\.\d\.\d\.?a(lpha\.)?\d+$/.test(current)) {
nextVersion = current.replace(/\d+$/, (match) => `${parseInt(match, 10) + 1}`);
} else if (current.endsWith('-SNAPSHOT')) {
// snapshots should not be bumped
Expand Down