Skip to content

Commit ce9d281

Browse files
committed
Merge branch 'main' into rasmuswl/no-dep-inst-default
2 parents dd20793 + 216127f commit ce9d281

File tree

282 files changed

+6790
-1562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+6790
-1562
lines changed

.github/actions/release-branches/release-branches.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import argparse
22
import json
33
import os
4-
import subprocess
4+
import configparser
55

66
# Name of the remote
77
ORIGIN = 'origin'
88

9-
OLDEST_SUPPORTED_MAJOR_VERSION = 2
9+
script_dir = os.path.dirname(os.path.realpath(__file__))
10+
grandparent_dir = os.path.dirname(os.path.dirname(script_dir))
11+
12+
config = configparser.ConfigParser()
13+
with open(os.path.join(grandparent_dir, 'releases.ini')) as stream:
14+
config.read_string('[default]\n' + stream.read())
15+
16+
OLDEST_SUPPORTED_MAJOR_VERSION = int(config['default']['OLDEST_SUPPORTED_MAJOR_VERSION'])
1017

1118
def main():
1219

.github/actions/release-initialise/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
shell: bash
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: 3.8
2222

.github/releases.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OLDEST_SUPPORTED_MAJOR_VERSION=2

.github/update-release-branch.py

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import datetime
3+
import re
34
from github import Github
45
import json
56
import os
@@ -174,6 +175,60 @@ def get_today_string():
174175
today = datetime.datetime.today()
175176
return '{:%d %b %Y}'.format(today)
176177

178+
def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):
179+
180+
# changelog entries can use the following format to indicate
181+
# that they only apply to newer versions
182+
some_versions_only_regex = re.compile(r'\[v(\d+)\+ only\]')
183+
184+
output = ''
185+
186+
with open('CHANGELOG.md', 'r') as f:
187+
188+
# until we find the first section, just duplicate all lines
189+
while True:
190+
line = f.readline()
191+
if not line:
192+
raise Exception('Could not find any change sections in CHANGELOG.md') # EOF
193+
194+
output += line
195+
if line.startswith('## '):
196+
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
197+
# we have found the first section, so now handle things differently
198+
break
199+
200+
# found_content tracks whether we hit two headings in a row
201+
found_content = False
202+
output += '\n'
203+
while True:
204+
line = f.readline()
205+
if not line:
206+
break # EOF
207+
line = line.rstrip('\n')
208+
209+
# filter out changenote entries that apply only to newer versions
210+
match = some_versions_only_regex.search(line)
211+
if match:
212+
if int(target_branch_major_version) < int(match.group(1)):
213+
continue
214+
215+
if line.startswith('## '):
216+
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
217+
if found_content == False:
218+
# we have found two headings in a row, so we need to add the placeholder message.
219+
output += 'No user facing changes.\n'
220+
found_content = False
221+
output += f'\n{line}\n\n'
222+
else:
223+
if line.strip() != '':
224+
found_content = True
225+
# we use the original line here, rather than the stripped version
226+
# so that we preserve indentation
227+
output += line + '\n'
228+
229+
with open('CHANGELOG.md', 'w') as f:
230+
f.write(output)
231+
177232
def update_changelog(version):
178233
if (os.path.exists('CHANGELOG.md')):
179234
content = ''
@@ -324,13 +379,7 @@ def main():
324379

325380
# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
326381
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
327-
subprocess.check_output(['sed', '-i', f's/^## {source_branch_major_version}\./## {target_branch_major_version}./g', 'CHANGELOG.md'])
328-
329-
# Remove changelog notes from all versions that do not apply to the vOlder branch
330-
print(f'Removing changelog notes that do not apply to v{target_branch_major_version}')
331-
for v in range(int(source_branch_major_version), int(target_branch_major_version), -1):
332-
print(f'Removing changelog notes that are tagged [v{v}+ only\]')
333-
subprocess.check_output(['sed', '-i', f'/^- \[v{v}+ only\]/d', 'CHANGELOG.md'])
382+
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)
334383

335384
# Amend the commit generated by `npm version` to update the CHANGELOG
336385
run_git('add', 'CHANGELOG.md')

.github/workflows/__all-platform-bundle.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__analyze-ref-input.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__autobuild-action.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__config-export.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__cpp-deptrace-disabled.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__cpp-deptrace-enabled-on-macos.yml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)