Files
tinyusb/tools/make_release.py
hathach 461dff5911 Fix code-review findings (changelog rendering, release skill, sidebar)
- changelog: fix 3 silent RST mis-renders carried over from the old monolith
  — Markdown link in 0.7.0, mismatched/single backticks in 0.18.0 / 0.20.0
- make-release skill contributors one-liner: parallelize the gh fetch, anchor
  the bot filter (was a substring that dropped handles like "abbott"), and join
  with ", " (paste -sd cycles the delimiter -> "@a,@b @c"); finalize now stages
  only the reviewed set (git add -A -- ':!.idea'); drop the obsolete CRLF gotcha
- make_release.py: emit LF not CRLF in the repository.yml insertion (fixes the
  gotcha at the source)
- docs sidebar: drop the hardcoded furo component list; override brand.html to
  include furo's own template + the sponsor button (decoupled from furo
  internals, no upper-bound pin needed); move sponsor styles into custom.css
- .pre-commit-config.yaml: drop stale end-of-file-fixer excludes for the
  deleted contributors/CoC include shims

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 10:57:26 +07:00

70 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python3
import re
import gen_doc
import gen_presets
version = '0.21.0'
print('version {}'.format(version))
ver_id = version.split('.')
###################
# src/tusb_option.h
###################
f_option_h = 'src/tusb_option.h'
with open(f_option_h) as f:
fdata = f.read()
fdata = re.sub(r'(#define TUSB_VERSION_MAJOR *) \d+', r"\1 {}".format(ver_id[0]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_MINOR *) \d+', r"\1 {}".format(ver_id[1]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_REVISION *) \d+', r"\1 {}".format(ver_id[2]), fdata)
# Write the file out again
with open(f_option_h, 'w') as f:
f.write(fdata)
###################
# repository.yml
###################
f_repository_yml = 'repository.yml'
with open(f_repository_yml) as f:
fdata = f.read()
if fdata.find(version) < 0:
fdata = re.sub(r'("0-latest"): "\d+\.\d+\.\d+"', r'"{}": "{}"\n \1: "{}"'.format(version, version, version), fdata)
with open(f_repository_yml, 'w') as f:
f.write(fdata)
###################
# library.json
###################
f_library_json = 'library.json'
with open(f_library_json) as f:
fdata = f.read()
fdata = re.sub(r'( {4}"version":) "\d+\.\d+\.\d+"', rf'\1 "{version}"', fdata)
with open(f_library_json, 'w') as f:
f.write(fdata)
###################
# sonar-project.properties
###################
f_sonar_properties = 'sonar-project.properties'
with open(f_sonar_properties) as f:
fdata = f.read()
fdata = re.sub(r'(sonar\.projectVersion=)\d+\.\d+\.\d+', r'\g<1>{}'.format(version), fdata)
with open(f_sonar_properties, 'w') as f:
f.write(fdata)
# gen docs
gen_doc.gen_deps_doc()
gen_doc.gen_boards_doc()
# gen presets
gen_presets.main()
###################
# docs/info/changelog/
###################
print("Add docs/info/changelog/{}.rst and list it at the top of docs/info/changelog/index.rst".format(version))