diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7a5991..197d829 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: Build production version on: push: - branches: [main, develop] + branches: [main] jobs: build-everything: @@ -35,6 +35,8 @@ jobs: if-no-files-found: error - name: Delete WIP tunes run: rm ./data/music/wip_*.pomf + - name: Add FS version into the file system + run: echo "$(git rev-parse --short HEAD)" > ./data/FS_VER - name: Create LittleFS image run: pio run --target buildfs --environment music-pomf - name: Upload filesystem image @@ -42,4 +44,15 @@ jobs: with: path: ./.pio/build/music-pomf/littlefs.bin name: filesystem.zip - if-no-files-found: error \ No newline at end of file + if-no-files-found: error + - name: Switch to public branch + run: git checkout pub + - name: Merge changes from main + run: git merge main + - name: Move things to FVUDATA for publishing + run: ./helper/ci/create_fvudata.sh + - name: Add FVUDATA stuff into git and push + run: | + git add -f ./webroot/fvudata/* + git commit -m "Publish firmwares at $(git rev-parse --short HEAD)" + git push --force -u origin pub \ No newline at end of file diff --git a/.gitignore b/.gitignore index cfb8eda..bab62f6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ captures/ /lib/nonfree-aquestalk/*.a /data/music/wip*.pomf /data/music/WIP*.pomf +/webroot/fvudata/* diff --git a/helper/ci/create_fvudata.sh b/helper/ci/create_fvudata.sh new file mode 100644 index 0000000..f3fe085 --- /dev/null +++ b/helper/ci/create_fvudata.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Directory containing the folders to check +source_dir="./.pio/build" +# Target directory for copied files +target_dir="./webroot/fvudata" + +# Create the target directory if it doesn't exist +mkdir -p "$target_dir" + +cp "./.pio/build/music-pomf/littlefs.bin" "$target_dir/fs.bin" +cp "./data/FS_VER" "$target_dir/fs_ver.txt" + +# Iterate over each entry in the source directory +for entry in "$source_dir"/*; do + # Check if the entry is a directory + if [ -d "$entry" ]; then + # Define the path to firmware.bin inside the current directory + firmware_file="$entry/firmware.bin" + + # Check if firmware.bin exists in the current directory + if [ -f "$firmware_file" ]; then + # Get the name of the directory (basename) + folder_name=$(basename "$entry") + + # Copy and rename firmware.bin to the target directory + cp "$firmware_file" "$target_dir/$folder_name.bin" + echo "Copied $firmware_file to $target_dir/$folder_name.bin" + else + echo "No firmware.bin found in $entry" + fi + fi +done