Skip to content

[12.x]: build: preparation for primary branch rename in the Angular repos #24791

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

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ var_13: &attach_release_output
var_14: &publish_branches_filter
branches:
only:
- main
# TODO(BRANCH_RENAME_CLEANUP): remove
- master
# 6.0.x, 7.1.x, etc.
- /\d+\.\d+\.x/
Expand Down Expand Up @@ -134,8 +136,10 @@ var_20: &slack_notify_on_failure
# Branch filter that only matches the main branch.
var_21: &only_main_branch_filter
branches:
only:
- master
only:
- main
# TODO(BRANCH_RENAME_CLEANUP): remove
- master

# -----------------------------
# Container version of CircleCI
Expand Down Expand Up @@ -715,7 +719,9 @@ workflows:
filters:
branches:
only:
# We only want to run the "master" branch against the snapshot builds because
# We only want to run the main branch against the snapshot builds because
# it's not guaranteed that older versions of Angular Material always work
# with the latest Angular version.
- main
# TODO(BRANCH_RENAME_CLEANUP): remove
- master
15 changes: 12 additions & 3 deletions .circleci/rebase-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,31 @@ async function _main() {
/**
* Sort a list of fullpath refs into a list and then provide the first entry.
*
* The sort order will first find master ref, and then any semver ref, followed
* The sort order will first find main branch, and then any semver ref, followed
* by the rest of the refs in the order provided.
*
* Branches are sorted in this order as work is primarily done on master, and
* otherwise on a semver branch. If neither of those were to match, the most
* Branches are sorted in this order as work is primarily done on main branches,
* and otherwise on a semver branch. If neither of those were to match, the most
* likely correct branch will be the first one encountered in the list.
*/
function getRefFromBranchList(gitOutput) {
const branches = gitOutput.split('\n').map(b => b.split('/').slice(1).join('').trim());
return branches.sort((a, b) => {
if (a === 'main') {
return -1;
}
if (b === 'main') {
return 1;
}

// TODO(BRANCH_RENAME_CLEANUP): remove
if (a === 'master') {
return -1;
}
if (b === 'master') {
return 1;
}

const aIsSemver = semverRegex.test(a);
const bIsSemver = semverRegex.test(b);
if (aIsSemver && bIsSemver) {
Expand Down