From 1b8a4791f504b44f9f38677f8d05a774826f7f05 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 28 Feb 2020 14:57:32 -0500 Subject: [PATCH 1/3] Download links now point to S3 via CloudFront --- .github/workflows/build.yml | 7 ------- tools/build_board_info.py | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 118135850e..d91e443589 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -276,10 +276,3 @@ jobs: - name: Install upload deps run: | pip install uritemplate - - name: Upload to Release - run: "[ -z \"$ADABOT_GITHUB_ACCESS_TOKEN\" ] || python3 -u upload_release_files.py" - working-directory: tools - env: - UPLOAD_URL: ${{ github.event.release.upload_url }} - ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.BLINKA_GITHUB_ACCESS_TOKEN }} - if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 1f074dddfc..5b13876904 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -21,6 +21,10 @@ HEX = ('hex',) HEX_UF2 = ('hex', 'uf2') SPK = ('spk',) +# Example: +# https://d111q2jukuzyg1.cloudfront.net/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2 +DOWNLOAD_BASE_URL = "https://d111q2jukuzyg1.cloudfront.net/bin" + # Default extensions extension_by_port = { "nrf": UF2, @@ -34,6 +38,8 @@ extension_by_port = { extension_by_board = { # samd "arduino_mkr1300": BIN, + "arduino_mkrzero": BIN, + "arduino_nano_33_iot": BIN, "arduino_zero": BIN, "feather_m0_adalogger": BIN_UF2, "feather_m0_basic": BIN_UF2, @@ -275,7 +281,14 @@ def generate_download_info(): files = [] new_version["files"][language] = files for extension in board_info["extensions"]: - files.append("https://github.com/adafruit/circuitpython/releases/download/{tag}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}".format(tag=new_tag, alias=alias, language=language, extension=extension)) + files.append( + "{base_url}/{alias}/{language}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}" + .format( + base_url=DOWNLOAD_BASE_URL, + tag=new_tag, + alias=alias, + language=language, + extension=extension)) current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["versions"].append(new_version) From c24a4f7d663bfc8e6020856b79b7ac0765ffb773 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 28 Feb 2020 16:23:49 -0500 Subject: [PATCH 2/3] change download prefix to https://downloads.circuitpython.org --- tools/build_board_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 5b13876904..778a6bbc2a 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -22,8 +22,8 @@ HEX_UF2 = ('hex', 'uf2') SPK = ('spk',) # Example: -# https://d111q2jukuzyg1.cloudfront.net/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2 -DOWNLOAD_BASE_URL = "https://d111q2jukuzyg1.cloudfront.net/bin" +# https://downloads.circuitpython.org/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2 +DOWNLOAD_BASE_URL = "https://downloads.circuitpython.org/bin" # Default extensions extension_by_port = { From 98a03fc93534a22d11c0a6a50f9982c397232ad3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 28 Feb 2020 21:18:48 -0500 Subject: [PATCH 3/3] upload bin and uf2 for arduino boards; remove unneeded build steps --- .github/workflows/build.yml | 3 --- tools/build_board_info.py | 8 ++++---- tools/upload_release_files.py | 35 ----------------------------------- 3 files changed, 4 insertions(+), 42 deletions(-) delete mode 100755 tools/upload_release_files.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d91e443589..32c949a3a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -273,6 +273,3 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) - - name: Install upload deps - run: | - pip install uritemplate diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 778a6bbc2a..3c8f44f740 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -37,10 +37,10 @@ extension_by_port = { # Per board overrides extension_by_board = { # samd - "arduino_mkr1300": BIN, - "arduino_mkrzero": BIN, - "arduino_nano_33_iot": BIN, - "arduino_zero": BIN, + "arduino_mkr1300": BIN_UF2, + "arduino_mkrzero": BIN_UF2, + "arduino_nano_33_iot": BIN_UF2, + "arduino_zero": BIN_UF2, "feather_m0_adalogger": BIN_UF2, "feather_m0_basic": BIN_UF2, "feather_m0_rfm69": BIN_UF2, diff --git a/tools/upload_release_files.py b/tools/upload_release_files.py deleted file mode 100755 index 4f193a8bec..0000000000 --- a/tools/upload_release_files.py +++ /dev/null @@ -1,35 +0,0 @@ -#! /usr/bin/env python3 - -import os -import os.path -import sys -import uritemplate - -sys.path.append("adabot") -import adabot.github_requests as github - -exit_status = 0 - -for dirpath, dirnames, filenames in os.walk("../bin"): - if not filenames: - continue - for filename in filenames: - full_filename = os.path.join(dirpath, filename) - label = filename.replace("adafruit-circuitpython-", "") - url_vars = {} - url_vars["name"] = filename - url_vars["label"] = label - url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars) - headers = {"content-type": "application/octet-stream"} - print(url) - with open(full_filename, "rb") as f: - response = github.post(url, data=f, headers=headers) - if not response.ok: - if response.status_code == 422 and response.json().get("errors", [{"code":""}])[0]["code"] == "already_exists": - print("File already uploaded. Skipping.") - continue - print("Upload of {} failed with {}.".format(filename, response.status_code)) - print(response.text) - sys.exit(response.status_code) - -sys.exit(exit_status)