Skip to content
Closed
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
63 changes: 44 additions & 19 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,42 +171,67 @@ jobs:
path: tmp/
pattern: "bdist_wheel_*"
merge-multiple: true

- name: Inspect tmp directory after downloading artifacts
run: ls -alFR tmp/

- name: Move and rename wheel files with pattern replacement
run: |
mkdir -p wheels/

# The whole point of the continuous release is to have a stable download link and the only way to have a PEP 440–compliant wheel name
# is to use a stable placeholder version. Otherwise, pip won't let you install the wheel. The cool thing is that we can now install the
# wheel directly from the GH pre-release which gets updated continuously, e.g.
# `pip install https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_main/bitsandbytes-1.33.7.preview-py3-none-manylinux_2_24_x86_64.whl`
STABLE_PLACEHOLDER_VERSION="1.33.7.preview"

# exclude macos wheels for now
find tmp/ -type f -name '*.whl' ! -name '*macos*' -print0 | while IFS= read -r -d '' wheel; do
wheel_filename=$(basename "$wheel")

# Strip off the original version
rest=${wheel_filename#bitsandbytes-*-}
new_name="bitsandbytes-${STABLE_PLACEHOLDER_VERSION}-${rest}"

echo "Renaming $wheel_filename → $new_name"
mv "$wheel" "wheels/${new_name}"
done

- name: Inspect wheels directory after renaming files
run: ls -alFR wheels/
- name: Create release and upload artifacts
uses: softprops/action-gh-release@v2.2.1

- name: Delete old pre-release (if exists)
run: |
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] A brief inline comment explaining the use of '|| true' could help clarify that failing to delete a non-existent release is expected behavior.

Suggested change
run: |
run: |
# Use '|| true' to ensure the script continues even if the release does not exist

Copilot uses AI. Check for mistakes.
gh release delete continuous-release_main --cleanup-tag -y || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate pip install commands for release body
run: |
cat <<'EOF' > body.md
## Latest `main` Wheel Pre-release

This pre-release contains the latest development wheels for all supported platforms, rebuilt automatically on every commit to the `main` branch.

**How to install:**
Pick the correct command for your platform and run it in your terminal:

EOF

for whl in wheels/*.whl; do
fname=$(basename "$whl")
url="https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_main/$fname"
echo "\`\`\`sh" >> body.md
echo "pip install $url" >> body.md
echo "\`\`\`" >> body.md
echo "" >> body.md
Comment on lines +214 to +217
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider refactoring the pip install command generation block by consolidating the multiple echo statements into a single heredoc or a separate script to improve readability and maintainability.

Suggested change
echo "\`\`\`sh" >> body.md
echo "pip install $url" >> body.md
echo "\`\`\`" >> body.md
echo "" >> body.md
cat <<EOF >> body.md
\`\`\`sh
pip install $url
\`\`\`
EOF

Copilot uses AI. Check for mistakes.
done

cat <<'EOF' >> body.md
> **Note:**
> These wheels are updated automatically with every commit to `main` and become available as soon as the [python-package.yml](.github/workflows/python-package.yml) workflow finishes.
EOF

- name: Create new pre-release and upload artifacts
uses: ncipollo/release-action@v1
with:
files: wheels/*.whl
prerelease: true
artifacts: wheels/*.whl
tag: continuous-release_main
name: Latest `main` wheel
tag_name: continuous-release_main
make_latest: false
draft: false
target_commitish: ${{ github.sha }}
bodyFile: body.md
prerelease: true
commit: ${{ github.sha }}


audit-wheels:
needs: build-wheels
Expand Down
Loading