Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync #83

Merged
merged 20 commits into from
Nov 14, 2024
Merged

sync #83

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -55,7 +53,6 @@ jobs:
with:
python-version: '3.9'

# Manual ESP-IDF Installation
- name: Install ESP-IDF
run: |
sudo apt-get update
Expand All @@ -70,93 +67,73 @@ 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: Download Bootloader
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
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 from $BOOTLOADER_URL"
echo "Error: Bootloader could not be downloaded."
exit 1
else
echo "Bootloader downloaded successfully to $BOOTLOADER_PATH"
echo "Bootloader downloaded successfully."
fi

- name: Package Build Artifacts
- name: Package Artifacts into ZIP
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
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: 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 Build Artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target.zip_name }}
path: ${{ matrix.target.zip_name }}

- name: Upload to Latest Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload_all:
name: Upload All to Cloudflare R2 and GitHub Release
needs: build
runs-on: ubuntu-latest

steps:
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: all_artifacts

- name: Verify and Flatten Artifacts
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)"
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: |
Expand All @@ -168,21 +145,62 @@ 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

- name: Upload Artifacts to Cloudflare R2
cat <<EOF > ~/.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: |
rclone copy "packaged_artifacts/${{ matrix.target.zip_name }}" "cloudflare_r2:${R2_BUCKET}/${R2_PATH}" --progress
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 --s3-no-check-bucket
else
echo "Skipping $file as it is not a valid file."
fi
done
echo "All artifacts uploaded successfully."

- name: Notify Discord of Successful Release
- 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 flat_artifacts/*; do
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 "Skipping $file as it is either empty or not a valid file."
fi
done

- name: Notify Discord of Successful Upload
if: success()
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
Expand All @@ -191,39 +209,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 and GitHub Release.",
"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"
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +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

Expand Down
Loading
Loading