|
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", |
|
394 | 398 | " print(f\"Released {ver}\")" |
395 | 399 | ] |
396 | 400 | }, |
| 401 | + { |
| 402 | + "cell_type": "code", |
| 403 | + "execution_count": null, |
| 404 | + "metadata": {}, |
| 405 | + "outputs": [], |
| 406 | + "source": [ |
| 407 | + "import subprocess" |
| 408 | + ] |
| 409 | + }, |
| 410 | + { |
| 411 | + "cell_type": "code", |
| 412 | + "execution_count": null, |
| 413 | + "metadata": {}, |
| 414 | + "outputs": [], |
| 415 | + "source": [ |
| 416 | + "res = subprocess.run(['git','tag'],capture_output=True,text=True).stdout" |
| 417 | + ] |
| 418 | + }, |
397 | 419 | { |
398 | 420 | "cell_type": "code", |
399 | 421 | "execution_count": null, |
|
867 | 889 | "#| hide\n", |
868 | 890 | "import nbdev; nbdev.nbdev_export()" |
869 | 891 | ] |
870 | | - }, |
871 | | - { |
872 | | - "cell_type": "code", |
873 | | - "execution_count": null, |
874 | | - "metadata": {}, |
875 | | - "outputs": [], |
876 | | - "source": [] |
877 | 892 | } |
878 | 893 | ], |
879 | 894 | "metadata": { |
|
0 commit comments