diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | ci/tidelift_relnotes.py | 50 | ||||
-rw-r--r-- | howto.txt | 2 |
3 files changed, 0 insertions, 55 deletions
@@ -165,8 +165,5 @@ relnotes_json: $(RELNOTES_JSON) ## Convert changelog to JSON for further parsin $(RELNOTES_JSON): $(CHANGES_MD) $(DOCBIN)/python ci/parse_relnotes.py tmp/rst_rst/changes.md $(RELNOTES_JSON) -tidelift_relnotes: $(RELNOTES_JSON) ## Upload parsed release notes to Tidelift. - $(DOCBIN)/python ci/tidelift_relnotes.py $(RELNOTES_JSON) pypi/coverage - github_releases: $(RELNOTES_JSON) ## Update GitHub releases. $(DOCBIN)/python ci/github_releases.py $(RELNOTES_JSON) nedbat/coveragepy diff --git a/ci/tidelift_relnotes.py b/ci/tidelift_relnotes.py deleted file mode 100644 index bc3a37d4..00000000 --- a/ci/tidelift_relnotes.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 -""" -Upload release notes from a JSON file to Tidelift as Markdown chunks - -Put your Tidelift API token in a file called tidelift.token alongside this -program, for example: - - user/n3IwOpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc2ZwE4 - -Run with two arguments: the JSON file of release notes, and the Tidelift -package name: - - python tidelift_relnotes.py relnotes.json pypi/coverage - -Every section that has something that looks like a version number in it will -be uploaded as the release notes for that version. - -""" - -import json -import os.path -import sys - -import requests - - -def update_release_note(package, version, text): - """Update the release notes for one version of a package.""" - url = f"https://api.tidelift.com/external-api/lifting/{package}/release-notes/{version}" - token_file = os.path.join(os.path.dirname(__file__), "tidelift.token") - with open(token_file) as ftoken: - token = ftoken.read().strip() - headers = { - "Authorization": f"Bearer: {token}", - } - req_args = dict(url=url, data=text.encode('utf8'), headers=headers) - result = requests.post(**req_args) - if result.status_code == 409: - result = requests.put(**req_args) - print(f"{version}: {result.status_code}") - -def upload(json_filename, package): - """Main function: parse markdown and upload to Tidelift.""" - with open(json_filename) as jf: - relnotes = json.load(jf) - for relnote in relnotes: - update_release_note(package, relnote["version"], relnote["text"]) - -if __name__ == "__main__": - upload(*sys.argv[1:]) # pylint: disable=no-value-for-parameter @@ -65,8 +65,6 @@ - CHANGES.rst - add an "Unreleased" section to the top. $ git push -- Update Tidelift: - $ make tidelift_relnotes - Update GitHub releases: $ make github_releases - Update readthedocs |