@@ -40,17 +40,42 @@ jobs:
4040 git config --global user.name "Alex Hultman"
4141 git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} binaries" || true
4242 git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries
43-
43+
4444 split-binaries :
45- needs : build
46- runs-on : ubuntu-latest
47- steps :
48- - name : Checkout binaries branch
49- uses : actions/checkout@v4
50- with :
51- ref : binaries # Explicitly switch to the binaries branch
52-
53- - name : List files
54- run : |
55- echo "Listing all compiled binaries and files:"
56- ls -R
45+ needs : build
46+ runs-on : ubuntu-latest
47+ steps :
48+ - name : Checkout binaries branch
49+ uses : actions/checkout@v4
50+ with :
51+ ref : binaries
52+ fetch-depth : 0
53+
54+ - name : Split and Push to Platform Branches
55+ run : |
56+ git config --global user.email "alexhultman@gmail.com"
57+ git config --global user.name "Alex Hultman"
58+
59+ # Define the mapping of filename patterns to target branches
60+ # Pattern: <filename_part>:<target_branch>
61+ PLATFORMS=("win32_x64:win32_x64_binaries" "linux_x64:linux_x64_binaries" "linux_arm64:linux_arm64_binaries" "darwin_x64:darwin_x64_binaries" "darwin_arm64:darwin_arm64_binaries")
62+
63+ for entry in "${PLATFORMS[@]}"; do
64+ PATTERN="${entry%%:*}"
65+ BRANCH="${entry#*:}"
66+
67+ echo "Processing $PATTERN for branch $BRANCH..."
68+
69+ # Create/Reset the target branch based on current binaries state
70+ git checkout -B $BRANCH
71+
72+ # Remove files that don't match this platform (keep only the relevant .node and .js)
73+ # This keeps the branch clean of other platforms' binaries
74+ find . -maxdepth 1 -type f ! -name "*${PATTERN}*" ! -name "*.js" ! -name "source_commit" -exec git rm {} \;
75+
76+ git commit -m "Update $BRANCH binaries" || true
77+ git push -f "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" $BRANCH
78+
79+ # Switch back to binaries to process the next platform
80+ git checkout binaries
81+ done
0 commit comments