Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
13 changes: 9 additions & 4 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Configuration file for mergify

# Branch version variables
variables:
current_minor: &current_minor "release/5.4.x"
previous_minor: &previous_minor "release/5.3.x"
previous_major: &previous_major "release/4.11.x"

defaults:
actions:
backport:
Expand Down Expand Up @@ -38,7 +44,6 @@ pull_request_rules:
actions:
backport:
branches:
# current minor release branch
- "release/5.2.x"
# previous major release branch
- "release/4.11.x"
- *current_minor
- *previous_minor
- *previous_major
51 changes: 30 additions & 21 deletions common/config/azure-pipelines/jobs/version-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,11 @@ jobs:
# e.g. if this release is `release/5.0.x`, value in `gather-docs.yaml`
# should be `release/4.<whatever_last_minor_release_version_was>.x`
# additionally if major version bump, the `mergify.yml` also needs to be edited manually
# if this release is `release/5.0.x`, the branches under actions/backport should be updated to look like:
# branches:
# # current minor release branch
# - "release/5.0.x"
# # previous major release branch
# - `release/4.<whatever_last_minor_release_version_was>.x`
# if this release is `release/5.0.x`, the branch variables in `mergify.yml` should be updated to look like:
# current_minor: &current_minor "release/5.0.x"
# previous_minor: &previous_minor null
# previous_major: &previous_major "release/4.<whatever_last_minor_release_version_was>.x"
# NOTE - previous_minor is intentionally set to null since there is no previous minor branch in a major release

if [ $((previousMinorVersion)) -lt 0 ]
then
Expand All @@ -143,12 +142,36 @@ jobs:
- bash: git push --set-upstream https://$(GITHUBTOKEN)@github.com/iTwin/itwinjs-core $(getBranchName.releaseBranchName) -q
displayName: Publish the release branch

- bash: |
# After creating release branch, update mergify.yml on master with new branch variables
git checkout master

mergifyPath=".github/mergify.yml"
releaseBranch=$(getBranchName.releaseBranchName)
newCurrentMinor="$releaseBranch"
echo "Updating mergify.yml backport branches for $newCurrentMinor"

# Get the current value of current_minor to move it to previous_minor
currentMinorValue=$(grep "current_minor:" "$mergifyPath" | sed 's/.*current_minor: &current_minor "\(.*\)"/\1/')
echo "Moving current minor '$currentMinorValue' to previous minor and setting new current minor to '$newCurrentMinor'"

# Handle both quoted strings and null values for previous_minor (matches both "value" and null)
sed -i "s|previous_minor: &previous_minor \(\".*\"\|null\)|previous_minor: \&previous_minor \"$currentMinorValue\"|" "$mergifyPath"
sed -i "s|current_minor: &current_minor \".*\"|current_minor: \&current_minor \"$newCurrentMinor\"|" "$mergifyPath"

# Commit and push changes
git add "$mergifyPath"
git commit -m "Update mergify.yml variables for release $newCurrentMinor" --author="imodeljs-admin <imodeljs-admin@users.noreply.github.com>"
git push https://$(GITHUBTOKEN)@github.com/iTwin/itwinjs-core HEAD:master
displayName: Update mergify.yml variables on master
continueOnError: true

- job: Bump
displayName: Bump Version
dependsOn:
- CreateBranch
- CheckPrevCommit
condition: and(in(dependencies.CreateBranch.result, 'Succeeded', 'Skipped'), in(dependencies.CheckPrevCommit.result, 'Succeeded', 'Skipped'))
condition: and(in(dependencies.CreateBranch.result, 'Succeeded', 'Skipped', 'SucceededWithIssues'), in(dependencies.CheckPrevCommit.result, 'Succeeded', 'Skipped'))
variables:
releaseBranchName: $[ dependencies.CreateBranch.outputs['getBranchName.releaseBranchName'] ]
deprecationCommentChangesMade: "false"
Expand Down Expand Up @@ -264,20 +287,6 @@ jobs:

- ${{ if eq(parameters.BumpType, 'minor') }}:

# When creating a minor release, the mergify.yml file needs to be updated to change the hardcoded branch names for security fixes
- bash: |
mergifyPath=".github/mergify.yml"
version=$(echo $(getVersion.version) | sed 's/\([0-9]*\.[0-9]*\)\.[0-9]*/\1.x/')
releaseBranch="release/$version"
majorVersion=$(echo $version | cut -d. -f1)
echo "Updating mergify.yml to backport to $releaseBranch for security fixes"

# Update the backporting release branch matching the major version number of the new version
sed -i "/\"release\/$majorVersion\.[0-9]*\.x\"/ s|\"release/$majorVersion\.[0-9]*\.x\"|\"$releaseBranch\"|" "$mergifyPath"

displayName: Update mergify.yml for new minor release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))

# When creating a minor release, the NextVersion.md need to be cleared and the contents placed into a {Version Number}.md file
- powershell: |
$sourceFile = 'docs/changehistory/NextVersion.md'
Expand Down
Loading