From f8f29066172f1f6601b575cb6a4488a5aa9d41ac Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:01:57 -0700 Subject: [PATCH 01/14] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index af2ec909..348e0288 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ Due to the **alpha** status, users should expect potential limitations, feature To install and configure Ghost ESP, follow our [Flashing Guide](https://github.com/Spooks4576/Ghost_ESP/blob/main/docs/HOWTOFLASH.md) for step-by-step instructions. Be sure to check for any known limitations specific to your ESP32 model before proceeding. +Make sure to check out our discord [Discord](https://discord.gg/PkdjxqYKe4) + + [![Flashing Tutorial](https://img.shields.io/badge/Tutorial-Flashing-blue)](https://github.com/Spooks4576/Ghost_ESP/wiki) ## Special Acknowledgments From cf1f28c7fe96b682bbd09e45773492f5641e3eb3 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Sat, 9 Nov 2024 11:37:19 -0700 Subject: [PATCH 02/14] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 348e0288..974f3ae6 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,16 @@ Due to the **alpha** status, users should expect potential limitations, feature ## Getting Started -To install and configure Ghost ESP, follow our [Flashing Guide](https://github.com/Spooks4576/Ghost_ESP/blob/main/docs/HOWTOFLASH.md) for step-by-step instructions. Be sure to check for any known limitations specific to your ESP32 model before proceeding. +To install and configure Ghost ESP, follow our [Flashing Guide](https://github.com/Spooks4576/Ghost_ESP/wiki) for step-by-step instructions. Be sure to check for any known limitations specific to your ESP32 model before proceeding. Make sure to check out our discord [Discord](https://discord.gg/PkdjxqYKe4) +## What Makes this different than ESP32 Marauder +This table should explain the key differences between ghost esp and ESP32 Marauder + +![Ghost_VS_Marauder](https://cdn.spookytools.com/assets/GhostESP_vs_Marauder_Comparison_Dark_Theme.png) + -[![Flashing Tutorial](https://img.shields.io/badge/Tutorial-Flashing-blue)](https://github.com/Spooks4576/Ghost_ESP/wiki) ## Special Acknowledgments From 5bac8c5fcbe70e666b7427026a14788af0417f5d Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:52:56 -0700 Subject: [PATCH 03/14] Update sdkconfig.ghostboard --- configs/sdkconfig.ghostboard | 130 ++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 55 deletions(-) diff --git a/configs/sdkconfig.ghostboard b/configs/sdkconfig.ghostboard index d5c65a55..320f630a 100644 --- a/configs/sdkconfig.ghostboard +++ b/configs/sdkconfig.ghostboard @@ -541,6 +541,77 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table +# +# Ghost ESP Options +# + +# +# LED Options +# +CONFIG_USE_NEOPIXEL=y +CONFIG_LED_DATA_PIN=10 +CONFIG_NUM_LEDS=3 +# end of LED Options + +# +# Display Options +# +# CONFIG_WITH_SCREEN is not set +# CONFIG_USE_TOUCHSCREEN is not set +# CONFIG_USE_JOYSTICK is not set +# CONFIG_USE_CARDPUTER is not set +# CONFIG_USE_7_INCHER is not set +# CONFIG_Waveshare_LCD is not set +# CONFIG_Crowtech_LCD is not set +# CONFIG_Sunton_LCD is not set +# CONFIG_USE_ILI9341_2 is not set +# end of Display Options + +# +# Ghost Board Config +# +CONFIG_IS_GHOST_BOARD=y +# CONFIG_GHOST_GPS_MODE is not set +# CONFIG_GHOST_MARAUDER_MODE is not set +# end of Ghost Board Config + +# +# GPS Configuration +# +CONFIG_HAS_GPS=y +CONFIG_GPS_UART_RX_PIN=2 +CONFIG_NMEA_PARSER_RING_BUFFER_SIZE=1024 +CONFIG_NMEA_PARSER_TASK_STACK_SIZE=3072 +CONFIG_NMEA_PARSER_TASK_PRIORITY=2 + +# +# NMEA Statement Support +# + +# +# At least one statement must be selected +# +CONFIG_NMEA_STATEMENT_GGA=y +CONFIG_NMEA_STATEMENT_GSA=y +CONFIG_NMEA_STATEMENT_GSV=y +CONFIG_NMEA_STATEMENT_RMC=y +CONFIG_NMEA_STATEMENT_GLL=y +CONFIG_NMEA_STATEMENT_VTG=y +# end of NMEA Statement Support +# end of GPS Configuration + +# +# SPI and MMC Configuration +# +CONFIG_USING_SPI=y +# CONFIG_USING_MMC is not set +CONFIG_SD_SPI_CS_PIN=23 +CONFIG_SD_SPI_CLK_PIN=19 +CONFIG_SD_SPI_MISO_PIN=20 +CONFIG_SD_SPI_MOSI_PIN=18 +# end of SPI and MMC Configuration +# end of Ghost ESP Options + # # Compiler options # @@ -1567,6 +1638,7 @@ CONFIG_LOG_DEFAULT_LEVEL_WARN=y # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set # CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set # CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set CONFIG_LOG_MAXIMUM_LEVEL=2 @@ -2143,58 +2215,6 @@ CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y # CONFIG_WIFI_PROV_STA_FAST_SCAN is not set # end of Wi-Fi Provisioning Manager -# -# Ghost ESP Options -# - -# -# LED Options -# -CONFIG_USE_NEOPIXEL=y -CONFIG_LED_DATA_PIN=10 -CONFIG_NUM_LEDS=3 -# end of LED Options - -# -# Display Options -# -# CONFIG_WITH_SCREEN is not set -# CONFIG_USE_TOUCHSCREEN is not set -# CONFIG_USE_JOYSTICK is not set -# CONFIG_USE_CARDPUTER is not set -# CONFIG_USE_7_INCHER is not set -# CONFIG_Waveshare_LCD is not set -# CONFIG_Crowtech_LCD is not set -# CONFIG_Sunton_LCD is not set -# CONFIG_USE_ILI9341_2 is not set -# end of Display Options - -# -# Ghost Board Config -# -CONFIG_IS_GHOST_BOARD=y -# CONFIG_GHOST_GPS_MODE is not set -# CONFIG_GHOST_MARAUDER_MODE is not set -# end of Ghost Board Config - -# -# GPS Configuration -# -# CONFIG_HAS_GPS is not set -# end of GPS Configuration - -# -# SPI and MMC Configuration -# -CONFIG_USING_SPI=y -# CONFIG_USING_MMC is not set -CONFIG_SD_SPI_CS_PIN=23 -CONFIG_SD_SPI_CLK_PIN=19 -CONFIG_SD_SPI_MISO_PIN=20 -CONFIG_SD_SPI_MOSI_PIN=18 -# end of SPI and MMC Configuration -# end of Ghost ESP Options - # # LVGL configuration # @@ -2641,8 +2661,8 @@ CONFIG_MDNS_PREDEF_NETIF_ETH=y # CONFIG_NO_BLOBS is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set CONFIG_LOG_BOOTLOADER_LEVEL=2 @@ -2827,4 +2847,4 @@ CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# End of deprecated options \ No newline at end of file +# End of deprecated options From 645540f7bbdfe5c77ca86544189070bf6d1dc80b Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:09:14 -0700 Subject: [PATCH 04/14] Update compile_generics.yml --- .github/workflows/compile_generics.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/compile_generics.yml b/.github/workflows/compile_generics.yml index 7462a234..3293ab97 100644 --- a/.github/workflows/compile_generics.yml +++ b/.github/workflows/compile_generics.yml @@ -175,13 +175,32 @@ jobs: echo "secret_access_key = $R2_SECRET_KEY" >> ~/.config/rclone/rclone.conf echo "endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com" >> ~/.config/rclone/rclone.conf + - name: Acquire Mutex Lock + uses: crazy-max/ghaction-mutex@v1 + with: + mutex: cloudflare-upload-lock + timeout: 3000 + - name: Upload Artifacts to Cloudflare R2 env: R2_BUCKET: "spooksapi" R2_PATH: "GhostESPBins" run: | + echo "Uploading ${{ matrix.target.zip_name }} to Cloudflare R2..." rclone copy "packaged_artifacts/${{ matrix.target.zip_name }}" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress + if [ $? -ne 0 ]; then + echo "Upload failed. Exiting..." + exit 1 + fi + echo "Upload of ${{ matrix.target.zip_name }} to Cloudflare R2 completed successfully." + + - name: Release Mutex Lock + uses: crazy-max/ghaction-mutex@v1 + with: + mutex: cloudflare-upload-lock + release: true + - name: Notify Discord of Successful Release if: success() env: From f27e7c66396d493cc06a53e10d68edb6c72ee377 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:13:56 -0700 Subject: [PATCH 05/14] Update compile_generics.yml --- .github/workflows/compile_generics.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/compile_generics.yml b/.github/workflows/compile_generics.yml index 3293ab97..5d9682e5 100644 --- a/.github/workflows/compile_generics.yml +++ b/.github/workflows/compile_generics.yml @@ -176,10 +176,11 @@ jobs: echo "endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com" >> ~/.config/rclone/rclone.conf - name: Acquire Mutex Lock - uses: crazy-max/ghaction-mutex@v1 + uses: softprops/turnstyle@v1 with: - mutex: cloudflare-upload-lock - timeout: 3000 + poll-interval-seconds: 10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Artifacts to Cloudflare R2 env: @@ -194,12 +195,6 @@ jobs: fi echo "Upload of ${{ matrix.target.zip_name }} to Cloudflare R2 completed successfully." - - name: Release Mutex Lock - uses: crazy-max/ghaction-mutex@v1 - with: - mutex: cloudflare-upload-lock - release: true - - name: Notify Discord of Successful Release if: success() From 5d40bf22a1537fb6d46ee583d3e04e91b325fb88 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:30:14 -0700 Subject: [PATCH 06/14] Build --- .../{compile_generics.yml => compile_all.yml} | 149 ++++-------------- 1 file changed, 31 insertions(+), 118 deletions(-) rename .github/workflows/{compile_generics.yml => compile_all.yml} (50%) diff --git a/.github/workflows/compile_generics.yml b/.github/workflows/compile_all.yml similarity index 50% rename from .github/workflows/compile_generics.yml rename to .github/workflows/compile_all.yml index 5d9682e5..1ba5631c 100644 --- a/.github/workflows/compile_generics.yml +++ b/.github/workflows/compile_all.yml @@ -11,8 +11,6 @@ jobs: strategy: matrix: target: - # sd_spi_cs_pin: 23, sd_spi_clk_pin: 19, sd_spi_miso_pin: 20, sd_spi_mosi_pin: 18, gps_uart_rx_pin: 15, gps_uart_tx_pin: 14 - # Generic configurations (no LED, no screen support) - { name: "esp32-generic", idf_target: "esp32", sdkconfig_file: "configs/sdkconfig.default.esp32", zip_name: "esp32-generic.zip" } - { name: "esp32s2-generic", idf_target: "esp32s2", sdkconfig_file: "configs/sdkconfig.default.esp32s2", zip_name: "esp32s2-generic.zip"} - { name: "esp32s3-generic", idf_target: "esp32s3", sdkconfig_file: "configs/sdkconfig.default.esp32s3", zip_name: "esp32s3-generic.zip" } @@ -55,7 +53,6 @@ jobs: with: python-version: '3.9' - # Manual ESP-IDF Installation - name: Install ESP-IDF run: | sudo apt-get update @@ -70,93 +67,40 @@ jobs: - name: Set up ESP-IDF and Target run: | . ~/esp-idf/export.sh - echo "FLAPPY_GHOST_WEB_HOOK=${{ secrets.FLAPPY_GHOST_WEB_HOOK }}" >> $GITHUB_ENV - echo "IDF_TARGET=${{ matrix.target.idf_target }}" >> $GITHUB_ENV export IDF_TARGET=${{ matrix.target.idf_target }} - echo "IDF_TARGET is set to $IDF_TARGET" - - - name: Verify SDK Config Options - run: | - echo "Checking if configurations exist in sdkconfig.defaults" - grep -E "CONFIG_WITH_SCREEN|CONFIG_TFT_WIDTH|CONFIG_TFT_HEIGHT|CONFIG_USE_TOUCHSCREEN|CONFIG_USE_JOYSTICK|CONFIG_USE_CARDPUTER|CONFIG_IS_GHOST_BOARD|CONFIG_USE_7_INCHER|CONFIG_Waveshare_LCD|CONFIG_Crowtech_LCD|CONFIG_Sunton_LCD|CONFIG_USE_ILI9341_2" sdkconfig.defaults || echo "One or more options not found in sdkconfig.defaults" - - - name: Clean and Remove Previous SDK Config - run: | - # Remove any previously generated sdkconfig file to avoid conflicts - rm -f sdkconfig - . ~/esp-idf/export.sh - idf.py clean + echo "IDF_TARGET=${{ matrix.target.idf_target }}" >> $GITHUB_ENV - - name: Build Project with sdkconfig.defaults + - name: Clean and Build Project env: SDKCONFIG_DEFAULTS: "sdkconfig.defaults" run: | . ~/esp-idf/export.sh + idf.py clean idf.py build - - name: Verify SDK Config Options - run: | - echo "Checking if configurations exist in sdkconfig.defaults" - grep -E "CONFIG_WITH_SCREEN|CONFIG_TFT_WIDTH|CONFIG_TFT_HEIGHT|CONFIG_USE_TOUCHSCREEN|CONFIG_USE_JOYSTICK|CONFIG_USE_CARDPUTER|CONFIG_IS_GHOST_BOARD|CONFIG_USE_7_INCHER|CONFIG_Waveshare_LCD|CONFIG_Crowtech_LCD|CONFIG_Sunton_LCD|CONFIG_USE_ILI9341_2" sdkconfig.defaults || echo "One or more options not found in sdkconfig.defaults" - - - name: Download Correct Bootloader + - name: Package Build Artifacts run: | - BOOTLOADER_URL="https://cdn.spookytools.com/bootloaders/${{ matrix.target.idf_target }}.bin" - BOOTLOADER_PATH="packaged_artifacts/bootloader.bin" - echo "Downloading bootloader from $BOOTLOADER_URL" mkdir -p packaged_artifacts - curl -L -o "$BOOTLOADER_PATH" "$BOOTLOADER_URL" - if [ ! -f "$BOOTLOADER_PATH" ]; then - echo "Error: Bootloader could not be downloaded from $BOOTLOADER_URL" - exit 1 - else - echo "Bootloader downloaded successfully to $BOOTLOADER_PATH" - fi + cp build/partition_table/partition-table.bin packaged_artifacts/ + cp build/*.bin packaged_artifacts/ + zip "packaged_artifacts/${{ matrix.target.zip_name }}" packaged_artifacts/* - - name: Package Build Artifacts - run: | - . ~/esp-idf/export.sh - PARTITION_TABLE_BIN=build/partition_table/partition-table.bin - GHOST_ESP_IDF_BIN=build/Ghost_ESP_IDF.bin - if [ ! -f "$PARTITION_TABLE_BIN" ]; then - echo "Error: $PARTITION_TABLE_BIN not found!" - exit 1 - fi - if [ ! -f "$GHOST_ESP_IDF_BIN" ]; then - echo "Error: $GHOST_ESP_IDF_BIN not found!" - exit 1 - fi - cp "$PARTITION_TABLE_BIN" packaged_artifacts/ - cp "$GHOST_ESP_IDF_BIN" packaged_artifacts/ - ZIP_NAME="${{ matrix.target.zip_name }}" - cd packaged_artifacts - zip "$ZIP_NAME" bootloader.bin partition-table.bin Ghost_ESP_IDF.bin - cd .. - - - name: Get the Latest Release ID (Including Pre-releases) - id: get_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - latest_release=$(curl -s \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/${{ github.repository }}/releases" | jq '[.[] | select(.draft == false)] | .[0]') - release_id=$(echo "$latest_release" | jq -r '.id') - echo "Latest release ID (including pre-releases) is $release_id" - echo "::set-output name=release_id::$release_id" - - - name: Upload to Latest Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - zip_file="packaged_artifacts/${{ matrix.target.zip_name }}" - release_id=${{ steps.get_release.outputs.release_id }} - curl -X POST \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/zip" \ - --data-binary @"$zip_file" \ - "https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=$(basename $zip_file)" + - name: Upload Build Artifacts to GitHub + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target.zip_name }} + path: packaged_artifacts/${{ matrix.target.zip_name }} + + upload_all: + name: Upload All to Cloudflare R2 + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download All Artifacts + uses: actions/download-artifact@v3 + with: + path: all_artifacts - name: Install rclone run: | @@ -174,29 +118,21 @@ jobs: echo "access_key_id = $R2_ACCESS_KEY" >> ~/.config/rclone/rclone.conf echo "secret_access_key = $R2_SECRET_KEY" >> ~/.config/rclone/rclone.conf echo "endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com" >> ~/.config/rclone/rclone.conf - - - name: Acquire Mutex Lock - uses: softprops/turnstyle@v1 - with: - poll-interval-seconds: 10 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Artifacts to Cloudflare R2 + - name: Upload All Artifacts to Cloudflare R2 env: R2_BUCKET: "spooksapi" R2_PATH: "GhostESPBins" run: | - echo "Uploading ${{ matrix.target.zip_name }} to Cloudflare R2..." - rclone copy "packaged_artifacts/${{ matrix.target.zip_name }}" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress + echo "Uploading all artifacts to Cloudflare R2..." + rclone copy all_artifacts cloudflare_r2:${R2_BUCKET}/${R2_PATH} --progress if [ $? -ne 0 ]; then echo "Upload failed. Exiting..." exit 1 fi - echo "Upload of ${{ matrix.target.zip_name }} to Cloudflare R2 completed successfully." + echo "All artifacts uploaded successfully." - - - name: Notify Discord of Successful Release + - name: Notify Discord of Successful Upload if: success() env: DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} @@ -205,39 +141,16 @@ jobs: { "embeds": [ { - "title": "🎉 New Release for Ghost ESP!", - "description": "A new release for Ghost ESP has been successfully compiled and is now available! Check out the latest release for details.", - "url": "${{ github.server_url }}/${{ github.repository }}/releases/latest", + "title": "🎉 New Build Artifacts Uploaded!", + "description": "All build artifacts have been successfully uploaded to Cloudflare R2.", "color": 5814783, - "fields": [ - { - "name": "Repository", - "value": "${{ github.repository }}", - "inline": true - }, - { - "name": "Version", - "value": "${{ github.event.release.tag_name }}", - "inline": true - }, - { - "name": "Commit", - "value": "${{ github.sha }}", - "inline": true - } - ], - "footer": { - "text": "GitHub Actions Bot", - "icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" - }, "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" } ] } EOF ) - curl -X POST \ -H "Content-Type: application/json" \ -d "$payload" \ - "$DISCORD_WEBHOOK_URL" + "$DISCORD_WEBHOOK_URL" \ No newline at end of file From 3149a20471d1ef8884b19c384d98d33edc63a8bb Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:42:22 -0700 Subject: [PATCH 07/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 1ba5631c..94e6b781 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -132,6 +132,32 @@ jobs: fi echo "All artifacts uploaded successfully." + - name: Get the Latest Release ID (Including Pre-releases) + id: get_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + latest_release=$(curl -s \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/${{ github.repository }}/releases" | jq '[.[] | select(.draft == false)] | .[0]') + release_id=$(echo "$latest_release" | jq -r '.id') + echo "Latest release ID (including pre-releases) is $release_id" + echo "::set-output name=release_id::$release_id" + + - name: Upload Artifacts to Latest Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for file in all_artifacts/*; do + echo "Uploading $file to GitHub Release..." + curl -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/zip" \ + --data-binary @"$file" \ + "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=$(basename $file)" + done + - name: Notify Discord of Successful Upload if: success() env: From ae664875aaf4b2eed389911276ada91b8d681382 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:53:09 -0700 Subject: [PATCH 08/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 94e6b781..16dd5c61 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -132,6 +132,12 @@ jobs: fi echo "All artifacts uploaded successfully." + + - name: Download All Artifacts + uses: actions/download-artifact@v3 + with: + path: all_artifacts + - name: Get the Latest Release ID (Including Pre-releases) id: get_release env: From 92ec6f3a899b70251d93c858893152cc09952d83 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:08:16 -0700 Subject: [PATCH 09/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 39 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 16dd5c61..99d8363a 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -92,7 +92,7 @@ jobs: path: packaged_artifacts/${{ matrix.target.zip_name }} upload_all: - name: Upload All to Cloudflare R2 + name: Upload All to Cloudflare R2 and GitHub Release needs: build runs-on: ubuntu-latest @@ -125,19 +125,16 @@ jobs: R2_PATH: "GhostESPBins" run: | echo "Uploading all artifacts to Cloudflare R2..." - rclone copy all_artifacts cloudflare_r2:${R2_BUCKET}/${R2_PATH} --progress - if [ $? -ne 0 ]; then - echo "Upload failed. Exiting..." - exit 1 - fi + for file in all_artifacts/*; do + if [ -f "$file" ]; then + echo "Uploading $file..." + rclone copy "$file" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress + else + echo "Skipped $file as it is not a valid file." + fi + done echo "All artifacts uploaded successfully." - - - name: Download All Artifacts - uses: actions/download-artifact@v3 - with: - path: all_artifacts - - name: Get the Latest Release ID (Including Pre-releases) id: get_release env: @@ -156,12 +153,16 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | for file in all_artifacts/*; do - echo "Uploading $file to GitHub Release..." - curl -X POST \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/zip" \ - --data-binary @"$file" \ - "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=$(basename $file)" + if [ -f "$file" ] && [ -s "$file" ]; then + echo "Uploading $file to GitHub Release..." + curl -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/zip" \ + --data-binary @"$file" \ + "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=$(basename $file)" + else + echo "Skipped $file as it is either empty or not a valid file." + fi done - name: Notify Discord of Successful Upload @@ -174,7 +175,7 @@ jobs: "embeds": [ { "title": "🎉 New Build Artifacts Uploaded!", - "description": "All build artifacts have been successfully uploaded to Cloudflare R2.", + "description": "All build artifacts have been successfully uploaded to Cloudflare R2 and GitHub Release.", "color": 5814783, "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" } From 23f2605a0cbc0f677b2fbce6f14bfce8657fc8d7 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:23:58 -0700 Subject: [PATCH 10/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 37 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 99d8363a..35327046 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -102,6 +102,19 @@ jobs: with: path: all_artifacts + - name: Verify and Flatten Artifacts + run: | + echo "Checking and flattening artifacts..." + mkdir -p flat_artifacts + if [ -d "all_artifacts" ] && [ "$(ls -A all_artifacts)" ]; then + find all_artifacts -type f -exec cp {} flat_artifacts/ \; + echo "Flattened artifacts:" + ls -lh flat_artifacts + else + echo "No artifacts found or directory is empty." + exit 1 + fi + - name: Install rclone run: | curl -fsSL https://rclone.org/install.sh | sudo bash @@ -112,25 +125,27 @@ jobs: R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }} run: | mkdir -p ~/.config/rclone - echo "[cloudflare_r2]" > ~/.config/rclone/rclone.conf - echo "type = s3" >> ~/.config/rclone/rclone.conf - echo "provider = Cloudflare" >> ~/.config/rclone/rclone.conf - echo "access_key_id = $R2_ACCESS_KEY" >> ~/.config/rclone/rclone.conf - echo "secret_access_key = $R2_SECRET_KEY" >> ~/.config/rclone/rclone.conf - echo "endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com" >> ~/.config/rclone/rclone.conf + cat < ~/.config/rclone/rclone.conf + [cloudflare_r2] + type = s3 + provider = Cloudflare + access_key_id = $R2_ACCESS_KEY + secret_access_key = $R2_SECRET_KEY + endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com + EOF - name: Upload All Artifacts to Cloudflare R2 env: R2_BUCKET: "spooksapi" R2_PATH: "GhostESPBins" run: | - echo "Uploading all artifacts to Cloudflare R2..." - for file in all_artifacts/*; do + echo "Uploading artifacts to Cloudflare R2..." + for file in flat_artifacts/*; do if [ -f "$file" ]; then echo "Uploading $file..." rclone copy "$file" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress else - echo "Skipped $file as it is not a valid file." + echo "Skipping $file as it is not a valid file." fi done echo "All artifacts uploaded successfully." @@ -152,7 +167,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - for file in all_artifacts/*; do + for file in flat_artifacts/*; do if [ -f "$file" ] && [ -s "$file" ]; then echo "Uploading $file to GitHub Release..." curl -X POST \ @@ -161,7 +176,7 @@ jobs: --data-binary @"$file" \ "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=$(basename $file)" else - echo "Skipped $file as it is either empty or not a valid file." + echo "Skipping $file as it is either empty or not a valid file." fi done From a3a5734fd879213bdddcab8270b2f2be091f5003 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:34:10 -0700 Subject: [PATCH 11/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 35327046..fa2a7eec 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -132,6 +132,7 @@ jobs: access_key_id = $R2_ACCESS_KEY secret_access_key = $R2_SECRET_KEY endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com + no_create_bucket = true EOF - name: Upload All Artifacts to Cloudflare R2 From 21a2ff2ef4122c4e5fc56eaed599d6e1c5361000 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:38:45 -0700 Subject: [PATCH 12/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index fa2a7eec..7fe1e90c 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -132,7 +132,6 @@ jobs: access_key_id = $R2_ACCESS_KEY secret_access_key = $R2_SECRET_KEY endpoint = https://fb5f7d31bedfe4f3538ddfa6db491962.r2.cloudflarestorage.com - no_create_bucket = true EOF - name: Upload All Artifacts to Cloudflare R2 @@ -144,7 +143,7 @@ jobs: for file in flat_artifacts/*; do if [ -f "$file" ]; then echo "Uploading $file..." - rclone copy "$file" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress + rclone copy "$file" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress --s3-no-check-bucket else echo "Skipping $file as it is not a valid file." fi From 7e81ee5046aba1d1da337e27d0eabead9fc647fe Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:00:20 -0700 Subject: [PATCH 13/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 7fe1e90c..2071879e 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -78,18 +78,33 @@ jobs: idf.py clean idf.py build - - name: Package Build Artifacts + - name: Download Bootloader + run: | + BOOTLOADER_URL="https://cdn.spookytools.com/bootloaders/${{ matrix.target.idf_target }}.bin" + BOOTLOADER_PATH="build/bootloader.bin" + echo "Downloading bootloader from $BOOTLOADER_URL..." + curl -L -o "$BOOTLOADER_PATH" "$BOOTLOADER_URL" + if [ ! -f "$BOOTLOADER_PATH" ]; then + echo "Error: Bootloader could not be downloaded." + exit 1 + else + echo "Bootloader downloaded successfully." + fi + + - name: Package Artifacts run: | mkdir -p packaged_artifacts cp build/partition_table/partition-table.bin packaged_artifacts/ cp build/*.bin packaged_artifacts/ - zip "packaged_artifacts/${{ matrix.target.zip_name }}" packaged_artifacts/* + cp build/bootloader.bin packaged_artifacts/ + echo "Packaging artifacts:" + ls -lh packaged_artifacts/ - name: Upload Build Artifacts to GitHub uses: actions/upload-artifact@v3 with: name: ${{ matrix.target.zip_name }} - path: packaged_artifacts/${{ matrix.target.zip_name }} + path: packaged_artifacts upload_all: name: Upload All to Cloudflare R2 and GitHub Release From 41443a3f3dcd21557aa1651bb34f32f773b9bb64 Mon Sep 17 00:00:00 2001 From: Spooks <62370103+Spooks4576@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:20:07 -0700 Subject: [PATCH 14/14] Update compile_all.yml --- .github/workflows/compile_all.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/compile_all.yml b/.github/workflows/compile_all.yml index 2071879e..1b123cf9 100644 --- a/.github/workflows/compile_all.yml +++ b/.github/workflows/compile_all.yml @@ -91,20 +91,25 @@ jobs: echo "Bootloader downloaded successfully." fi - - name: Package Artifacts + - name: Package Artifacts into ZIP run: | - mkdir -p packaged_artifacts - cp build/partition_table/partition-table.bin packaged_artifacts/ - cp build/*.bin packaged_artifacts/ - cp build/bootloader.bin packaged_artifacts/ - echo "Packaging artifacts:" - ls -lh packaged_artifacts/ + ARTIFACT_DIR="packaged_artifacts" + ZIP_FILE="${{ matrix.target.zip_name }}" + mkdir -p "$ARTIFACT_DIR" + cp build/partition_table/partition-table.bin "$ARTIFACT_DIR/" + cp build/*.bin "$ARTIFACT_DIR/" + echo "Packaging into zip: $ZIP_FILE" + cd "$ARTIFACT_DIR" + zip "../$ZIP_FILE" ./* + cd .. + echo "Zip file $ZIP_FILE created." + ls -lh "$ZIP_FILE" - name: Upload Build Artifacts to GitHub uses: actions/upload-artifact@v3 with: name: ${{ matrix.target.zip_name }} - path: packaged_artifacts + path: ${{ matrix.target.zip_name }} upload_all: name: Upload All to Cloudflare R2 and GitHub Release