|
40 | 40 | git config --global user.name "Alex Hultman" |
41 | 41 | git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} binaries" || true |
42 | 42 | git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries |
43 | | - |
44 | | - 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 |
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 | | - PLATFORMS=("win32_x64" "linux_x64" "linux_arm64" "darwin_x64" "darwin_arm64") |
60 | | -
|
61 | | - for PLATFORM in "${PLATFORMS[@]}"; do |
62 | | - BRANCH="${PLATFORM}_binaries" |
63 | | - echo "Updating $BRANCH..." |
64 | | -
|
65 | | - # 1. Fetch existing branch OR create a CLEAN orphan |
66 | | - if git fetch origin $BRANCH; then |
67 | | - git checkout $BRANCH |
68 | | - git reset --hard origin/$BRANCH |
69 | | - else |
70 | | - git checkout --orphan $BRANCH |
71 | | - git rm -rf . # CRITICAL: Remove leftovers from the 'binaries' branch |
72 | | - fi |
73 | | - |
74 | | - # 2. Sync files for this platform |
75 | | - git checkout binaries -- "*${PLATFORM}*" "source_commit" |
76 | | - |
77 | | - # 3. Read the SHA for the commit message |
78 | | - SOURCE_SHA=$(cat source_commit | tr -d '\n\r') |
79 | | -
|
80 | | - # 4. Commit and push |
81 | | - git add . |
82 | | - if git commit -m "[GitHub Actions] $PLATFORM binaries for $SOURCE_SHA"; then |
83 | | - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" $BRANCH |
84 | | - else |
85 | | - echo "No changes for $PLATFORM, skipping push." |
86 | | - fi |
87 | | - |
88 | | - # 5. Force jump back to binaries branch to clean the workspace for the next loop |
89 | | - git checkout -f binaries |
90 | | - done |
0 commit comments