|
158 | 158 | "from ghapi.core import *\n", |
159 | 159 | "\n", |
160 | 160 | "from datetime import datetime\n", |
| 161 | + "from packaging.version import Version\n", |
161 | 162 | "import shutil,subprocess\n", |
162 | 163 | "\n", |
163 | 164 | "from nbdev.doclinks import *" |
|
285 | 286 | " \"Create the CHANGELOG.md file, or return the proposed text if `debug` is `True`\"\n", |
286 | 287 | " if not self.changefile.exists(): self.changefile.write_text(\"# Release notes\\n\\n<!-- do not remove -->\\n\")\n", |
287 | 288 | " marker = '<!-- do not remove -->\\n'\n", |
288 | | - " try: self.commit_date = self.gh.repos.get_latest_release().published_at\n", |
289 | | - " except HTTP404NotFoundError: self.commit_date = '2000-01-01T00:00:004Z'\n", |
| 289 | + " try: self.commit_date = (lr:=self.gh.repos.get_latest_release()).published_at\n", |
| 290 | + " except HTTP404NotFoundError: lr,self.commit_date = None,'2000-01-01T00:00:004Z'\n", |
| 291 | + " if lr and (Version(self.cfg.version) <= Version(lr.tag_name)): \n", |
| 292 | + " print(f'Error: Version bump required: expected: >{lr.tag_name}, got: {self.cfg.version}.')\n", |
| 293 | + " raise SystemExit(1)\n", |
290 | 294 | " res = f\"\\n## {self.cfg.version}\\n\"\n", |
291 | 295 | " issues = self._issue_groups()\n", |
292 | 296 | " res += '\\n'.join(_issues_txt(*o) for o in zip(issues, self.groups.values()))\n", |
|
867 | 871 | "#| hide\n", |
868 | 872 | "import nbdev; nbdev.nbdev_export()" |
869 | 873 | ] |
870 | | - }, |
871 | | - { |
872 | | - "cell_type": "code", |
873 | | - "execution_count": null, |
874 | | - "metadata": {}, |
875 | | - "outputs": [], |
876 | | - "source": [] |
877 | 874 | } |
878 | 875 | ], |
879 | 876 | "metadata": { |
|
0 commit comments