diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 179e1b0997..7872ca6b11 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,8 +48,8 @@ jobs: uses: ./tools/github-actions/new-version with: defaultBranch: main - defaultBranchPrereleaseName: alpha - releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:alpha|beta|next|rc))?$' + defaultBranchPrereleaseName: prerelease + releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:next|prerelease|rc))?$' - name: Create release if: github.event_name != 'pull_request' && github.event_name != 'merge_group' run: gh release create v${{ steps.newVersion.outputs.nextVersionTag }} --generate-notes ${{ contains( steps.newVersion.outputs.nextVersionTag, '-' ) && '--prerelease' || '' }} --target ${{ github.ref_name }} diff --git a/tools/github-actions/cascading/readme.md b/tools/github-actions/cascading/readme.md index c61075029a..9f367e6e59 100644 --- a/tools/github-actions/cascading/readme.md +++ b/tools/github-actions/cascading/readme.md @@ -5,7 +5,7 @@ ## Overview This plugin is meant to implement the Bitbucket cascading mechanism on GitHub. -For the moment, the branching model supported is the following one : release/Maj.min[.0-alpha|beta|next|rc] and a default branch from your choice. +For the moment, the branching model supported is the following one : release/Maj.min[.0-next|prerelease|rc] and a default branch from your choice. This pattern is restrictive on purpose, to prevent any issue where some non-release branches could match as well. ## Task options @@ -32,7 +32,7 @@ The cascading task is logging a lot of information, don't hesitate to have a loo ## Usage example ```yaml -- name: Cascading +- name: Cascading id: cascading uses: AmadeusITGroup/otter/tools/github-actions/cascading@8 with: diff --git a/tools/github-actions/cascading/src/helpers.spec.ts b/tools/github-actions/cascading/src/helpers.spec.ts index 3113b04336..0fa5867cf0 100644 --- a/tools/github-actions/cascading/src/helpers.spec.ts +++ b/tools/github-actions/cascading/src/helpers.spec.ts @@ -6,15 +6,15 @@ describe('helpers', () => { expect(sortBranches(['release/1.2', 'release/2.2', 'release/3.2'])).toEqual(['release/1.2', 'release/2.2', 'release/3.2']); expect(sortBranches(['release/1.2', 'release/0.1', 'release/3.1', 'release/0.4'])) .toEqual(['release/0.1', 'release/0.4', 'release/1.2', 'release/3.1']); - expect(sortBranches(['release/3.0.0-next', 'release/2.5.0-alpha', 'release/1.2', 'release/2.4', 'release/0.1'])) - .toEqual(['release/0.1', 'release/1.2', 'release/2.4', 'release/2.5.0-alpha', 'release/3.0.0-next']); + expect(sortBranches(['release/3.0.0-next', 'release/3.0.0-prerelease', 'release/2.5.0-prerelease', 'release/1.2', 'release/2.4', 'release/0.1'])) + .toEqual(['release/0.1', 'release/1.2', 'release/2.4', 'release/2.5.0-prerelease', 'release/3.0.0-next', 'release/3.0.0-prerelease']); }); it('formatGitBranchOutput', () => { const fakeOutput = ' remotes/origin/test/3.2 \n remotes/origin/release/0.1.0-test \n remotes/origin/release/0.1-test \n ' + 'remotes/origin/feature/whatever \n remotes/origin/release/0.1 \n remotes/origin/release/1.2 \n remotes/origin/bugfix/whatever ' + - '\r\n remotes/origin/release/2.4 \n remotes/origin/release/2.5.0-alpha \r\n remotes/origin/release/3.0.0-next'; - expect(extractBranchesFromGitOutput(fakeOutput)).toEqual(['release/0.1', 'release/1.2', 'release/2.4', 'release/2.5.0-alpha', 'release/3.0.0-next']); + '\r\n remotes/origin/release/2.4 \n remotes/origin/release/2.5.0-prerelease \r\n remotes/origin/release/3.0.0-rc \r\n remotes/origin/release/3.0.0-next'; + expect(extractBranchesFromGitOutput(fakeOutput)).toEqual(['release/0.1', 'release/1.2', 'release/2.4', 'release/2.5.0-prerelease', 'release/3.0.0-rc', 'release/3.0.0-next']); }); it('Extract packages name from multiline package json content', () => { diff --git a/tools/github-actions/cascading/src/helpers.ts b/tools/github-actions/cascading/src/helpers.ts index e047d106e4..0a1cca1e38 100644 --- a/tools/github-actions/cascading/src/helpers.ts +++ b/tools/github-actions/cascading/src/helpers.ts @@ -26,7 +26,7 @@ export function sortBranches(branches: string[]) { } /** - * Extract just the branches matching the release/min.maj[.0-alpha|beta|next|rc] format + * Extract just the branches matching the release/min.maj[.0-next|prerelease|rc] format * @param gitOutput */ export function extractBranchesFromGitOutput(gitOutput: string) { @@ -35,7 +35,7 @@ export function extractBranchesFromGitOutput(gitOutput: string) { .replace(/ /g, '') .replace('remotes/origin/', '') ) - .filter((val) => /release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(alpha|beta|next|rc))?$/.test(val)); + .filter((val) => /release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(next|prerelease|rc))?$/.test(val)); } /** diff --git a/tools/github-actions/new-version/action.yml b/tools/github-actions/new-version/action.yml index d935d25b2d..a13bae743c 100644 --- a/tools/github-actions/new-version/action.yml +++ b/tools/github-actions/new-version/action.yml @@ -2,10 +2,10 @@ name: 'New version' description: 'Compute the next-version of your branch, based on repository tags' inputs: defaultBranchPrereleaseName: - description: 'Default branch pre-release tag (eg. alpha)' + description: 'Default branch pre-release tag (eg. prerelease)' required: false defaultBranch: - description: 'If your branching model relies on a default branch that is not a release branch (such as master or develop), you can specify its name here so the task will compute versions for builds happening on that branch.' + description: 'If your branching model relies on a default branch that is not a release branch (such as main or develop), you can specify its name here so the task will compute versions for builds happening on that branch.' required: false defaultBranchVersionMask: description: 'You can specify a version mask if you want to bypass the default mechanism of the task when it comes to default branch version computation.' @@ -15,7 +15,7 @@ inputs: releaseBranchRegExp: description: 'Versioned release branch regular expression' required: false - default: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:alpha|beta|next|rc))?$' + default: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:next|prerelease|rc))?$' outputs: nextVersionTag: description: 'Next version Tag' diff --git a/tools/github-actions/new-version/readme.md b/tools/github-actions/new-version/readme.md index 82e073da05..b5e9bf2909 100644 --- a/tools/github-actions/new-version/readme.md +++ b/tools/github-actions/new-version/readme.md @@ -5,7 +5,7 @@ This task computes new version candidates based on the repository tags as well as the branch on which it is executed. It supports in terms of branching model: -* By default, release branches named ``release/Major.Minor[.0-alpha|beta|next|rc]`` (configurable through releaseBranchRegExp) +* By default, release branches named ``release/Major.Minor[.0-next|prerelease|rc]`` (configurable through releaseBranchRegExp) * One default branch that can be parametrised (``master``, ``develop``, ...) If the plugin doesn't support the current branch it raises a warning that says that the version cannot be computed. @@ -21,9 +21,9 @@ If run on a compatible branch, the plug-in will compute the next version as foll * If no tag is found, the plug-in returns ``Major.Minor.0`` * If run on a pull request build, it doesn't increment the patch version but instead concatenate ``-pr.buildId`` to the latest, or to ``Major.Minor.0`` -### On a pre-release branch ``release/Major.Minor.0-(alpha|beta|next|rc)`` +### On a pre-release branch ``release/Major.Minor.0-(next|prerelease|rc)`` -It behaves the same as above, but instead of producing ``Major.Minor.0`` it would produce ``release/Major.Minor.0-(alpha|beta|next|rc).0`` +It behaves the same as above, but instead of producing ``Major.Minor.0`` it would produce ``release/Major.Minor.0-(next|prerelease|rc).0`` ### On a default branch @@ -46,6 +46,6 @@ See [Action specifications](action.yml) directly for more information about the uses: AmadeusITGroup/otter/tools/github-actions/new-version@9 with: defaultBranch: main - defaultBranchPrereleaseName: alpha - releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:alpha|beta|next|rc))?$' + defaultBranchPrereleaseName: prerelease + releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:next|prerelease|rc))?$' ``` diff --git a/tools/github-actions/new-version/src/new-version.spec.ts b/tools/github-actions/new-version/src/new-version.spec.ts index 8b407df61e..b7bd76a938 100644 --- a/tools/github-actions/new-version/src/new-version.spec.ts +++ b/tools/github-actions/new-version/src/new-version.spec.ts @@ -19,7 +19,7 @@ describe('New Version', () => { baseBranch: '2.6', isPullRequest: false, prPreReleaseTag: 'pr', - releaseBranchRegExp: new RegExp(/release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(alpha|beta|next|rc))?$/) + releaseBranchRegExp: new RegExp(/release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(next|prerelease|rc))?$/) }; const defaultTags = ['0.10.0', '2.6.0', '3.1.5', '3.2.4', '3.2.5.0', 'whatever', '3.3.0-alpha.0', '3.3.0-alpha.0', '3.3.0-rc.0']; @@ -62,7 +62,7 @@ describe('New Version', () => { isPullRequest: false, defaultBranch: 'develop', prPreReleaseTag: 'pr', - releaseBranchRegExp: new RegExp(/release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(alpha|beta|next|rc))?$/) + releaseBranchRegExp: new RegExp(/release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(next|prerelease|rc))?$/) }; it('should compute release versions correctly', () => { diff --git a/tools/github-actions/new-version/src/new-version.ts b/tools/github-actions/new-version/src/new-version.ts index abdea8d60c..d03dd582ba 100644 --- a/tools/github-actions/new-version/src/new-version.ts +++ b/tools/github-actions/new-version/src/new-version.ts @@ -142,7 +142,7 @@ export class NewVersion { // If release branch, we filter all versions that do not satisfy the branch name to exclude 3.6.0-alpha.2 when building branch release/3.6 for example parsedSortedTags = parsedSortedTags.filter((parsedTag) => semver.satisfies(parsedTag, `~${versionMask}`)); } else { - const releaseTags = [...this.defaultBranchPrereleaseName ? [this.defaultBranchPrereleaseName] : [], 'alpha', 'beta', 'rc']; + const releaseTags = [...this.defaultBranchPrereleaseName ? [this.defaultBranchPrereleaseName] : [], 'prerelease', 'rc']; parsedSortedTags = parsedSortedTags.filter((parsedTag) => parsedTag.prerelease.length === 0 || releaseTags.includes(`${parsedTag.prerelease[0]}`) );