Create a new release on GitHub.
(new_version: str, notes: str)
| 85 | |
| 86 | |
| 87 | def create_github_release(new_version: str, notes: str): |
| 88 | """Create a new release on GitHub.""" |
| 89 | url = f'https://api.github.com/repos/{REPO}/releases' |
| 90 | |
| 91 | data = { |
| 92 | 'tag_name': f'v{new_version}', |
| 93 | 'name': f'v{new_version}', |
| 94 | 'body': notes, |
| 95 | 'draft': True, |
| 96 | } |
| 97 | |
| 98 | response = requests.post( |
| 99 | url, |
| 100 | headers={ |
| 101 | 'Authorization': f'Bearer {GITHUB_TOKEN}', |
| 102 | 'Accept': 'application/vnd.github+json', |
| 103 | }, |
| 104 | json=data, |
| 105 | timeout=10, |
| 106 | ) |
| 107 | try: |
| 108 | response.raise_for_status() |
| 109 | except requests.exceptions.HTTPError as e: |
| 110 | print(f'HTTP error occurred: {e}') |
| 111 | print(f'Response content: {response.content.decode()}') |
| 112 | raise e |
| 113 | |
| 114 | |
| 115 | def create_github_release_draft(rl_version: str, rl_release_notes: str): |