Skip to content

Commit 40594df

Browse files
committed
Upload wheels to wheels branch
1 parent ff649cb commit 40594df

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

.github/workflows/wasm.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,45 @@ jobs:
4949
# Testing is automatically made by cibuildwheel
5050
run: cibuildwheel --platform pyodide
5151

52-
- name: Move wheels into /wheels directory for GitHub Pages and trigger gh pages redeploy
52+
- name: Publish wheels to orphan `wheels` branch
5353
if: startsWith(github.ref, 'refs/tags/')
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5456
run: |
55-
# Switch to real branch
56-
git fetch origin main
57-
git checkout main
58-
git pull
5957
60-
# Copy new wheels
58+
# Create a fresh working directory
59+
rm -rf wheels-branch
60+
mkdir wheels-branch
61+
cd wheels-branch
62+
63+
# Fetch existing wheels branch if it exists
64+
git init
65+
git remote add origin https://github.com/${{ github.repository }}.git
66+
git fetch origin wheels || true
67+
68+
# Create an orphan branch (separate history)
69+
git checkout --orphan wheels
70+
71+
# Clear all files in branch
72+
git reset --hard
73+
74+
# Add wheels
6175
mkdir -p wheels
62-
rm -f wheels/*.whl || true
63-
cp wheelhouse/*.whl wheels/
76+
cp ../wheelhouse/*.whl wheels/
6477
65-
echo "Copied wheels:"
78+
echo "Wheels to publish:"
6679
ls -lh wheels/
6780
6881
# Commit
6982
git config user.name "GitHub Actions"
7083
git config user.email "[email protected]"
7184
72-
git add -f wheels
85+
git add wheels
86+
git commit -m "Update wheels for release ${{ github.ref_name }}"
87+
88+
# Force push as this branch always resets
89+
git push origin wheels --force
7390
74-
git commit -a -m "Update wheels for release ${{ github.ref_name }}"
75-
git push origin main
7691
7792
# This is not working yet
7893
# - name: Upload wheel to release

0 commit comments

Comments
 (0)