diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 09640d091..a0c84022a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -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: | + 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 + 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