| 1 | name: PyPI Publish |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - 'python-v*' |
| 7 | |
| 8 | jobs: |
| 9 | linux: |
| 10 | name: Python ${{ matrix.config.platform }} manylinux${{ matrix.config.manylinux }} |
| 11 | timeout-minutes: 60 |
| 12 | strategy: |
| 13 | matrix: |
| 14 | config: |
| 15 | - platform: x86_64 |
| 16 | manylinux: "2_17" |
| 17 | extra_args: "" |
| 18 | - platform: x86_64 |
| 19 | manylinux: "2_28" |
| 20 | extra_args: "--features fp16kernels" |
| 21 | - platform: aarch64 |
| 22 | manylinux: "2_24" |
| 23 | extra_args: "" |
| 24 | # We don't build fp16 kernels for aarch64, because it uses |
| 25 | # cross compilation image, which doesn't have a new enough compiler. |
| 26 | runs-on: "ubuntu-22.04" |
| 27 | steps: |
| 28 | - uses: actions/checkout@v4 |
| 29 | with: |
| 30 | fetch-depth: 0 |
| 31 | lfs: true |
| 32 | - name: Set up Python |
| 33 | uses: actions/setup-python@v4 |
| 34 | with: |
| 35 | python-version: 3.8 |
| 36 | - uses: ./.github/workflows/build_linux_wheel |
| 37 | with: |
| 38 | python-minor-version: 8 |
| 39 | args: "--release --strip ${{ matrix.config.extra_args }}" |
| 40 | arm-build: ${{ matrix.config.platform == 'aarch64' }} |
| 41 | manylinux: ${{ matrix.config.manylinux }} |
| 42 | - uses: ./.github/workflows/upload_wheel |
| 43 | with: |
| 44 | pypi_token: ${{ secrets.LANCEDB_PYPI_API_TOKEN }} |
| 45 | fury_token: ${{ secrets.FURY_TOKEN }} |
| 46 | mac: |
| 47 | timeout-minutes: 60 |
| 48 | runs-on: ${{ matrix.config.runner }} |
| 49 | strategy: |
| 50 | matrix: |
| 51 | config: |
| 52 | - target: x86_64-apple-darwin |
| 53 | runner: macos-13 |
| 54 | - target: aarch64-apple-darwin |
| 55 | runner: macos-14 |
| 56 | env: |
| 57 | MACOSX_DEPLOYMENT_TARGET: 10.15 |
| 58 | steps: |
| 59 | - uses: actions/checkout@v4 |
| 60 | with: |
| 61 | fetch-depth: 0 |
| 62 | lfs: true |
| 63 | - name: Set up Python |
| 64 | uses: actions/setup-python@v4 |
| 65 | with: |
| 66 | python-version: 3.12 |
| 67 | - uses: ./.github/workflows/build_mac_wheel |
| 68 | with: |
| 69 | python-minor-version: 8 |
| 70 | args: "--release --strip --target ${{ matrix.config.target }} --features fp16kernels" |
| 71 | - uses: ./.github/workflows/upload_wheel |
| 72 | with: |
| 73 | pypi_token: ${{ secrets.LANCEDB_PYPI_API_TOKEN }} |
| 74 | fury_token: ${{ secrets.FURY_TOKEN }} |
| 75 | windows: |
| 76 | timeout-minutes: 60 |
| 77 | runs-on: windows-latest |
| 78 | steps: |
| 79 | - uses: actions/checkout@v4 |
| 80 | with: |
| 81 | fetch-depth: 0 |
| 82 | lfs: true |
| 83 | - name: Set up Python |
| 84 | uses: actions/setup-python@v4 |
| 85 | with: |
| 86 | python-version: 3.8 |
| 87 | - uses: ./.github/workflows/build_windows_wheel |
| 88 | with: |
| 89 | python-minor-version: 8 |
| 90 | args: "--release --strip" |
| 91 | vcpkg_token: ${{ secrets.VCPKG_GITHUB_PACKAGES }} |
| 92 | - uses: ./.github/workflows/upload_wheel |
| 93 | with: |
| 94 | pypi_token: ${{ secrets.LANCEDB_PYPI_API_TOKEN }} |
| 95 | fury_token: ${{ secrets.FURY_TOKEN }} |
| 96 | gh-release: |
| 97 | runs-on: ubuntu-latest |
| 98 | permissions: |
| 99 | contents: write |
| 100 | steps: |
| 101 | - uses: actions/checkout@v4 |
| 102 | with: |
| 103 | fetch-depth: 0 |
| 104 | lfs: true |
| 105 | - name: Extract version |
| 106 | id: extract_version |
| 107 | env: |
| 108 | GITHUB_REF: ${{ github.ref }} |
| 109 | run: | |
| 110 | set -e |
| 111 | echo "Extracting tag and version from $GITHUB_REF" |
| 112 | if [[ $GITHUB_REF =~ refs/tags/python-v(.*) ]]; then |
| 113 | VERSION=${BASH_REMATCH[1]} |
| 114 | TAG=python-v$VERSION |
| 115 | echo "tag=$TAG" >> $GITHUB_OUTPUT |
| 116 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 117 | else |
| 118 | echo "Failed to extract version from $GITHUB_REF" |
| 119 | exit 1 |
| 120 | fi |
| 121 | echo "Extracted version $VERSION from $GITHUB_REF" |
| 122 | if [[ $VERSION =~ beta ]]; then |
| 123 | echo "This is a beta release" |
| 124 | |
| 125 | # Get last release (that is not this one) |
| 126 | FROM_TAG=$(git tag --sort='version:refname' \ |
| 127 | | grep ^python-v \ |
| 128 | | grep -vF "$TAG" \ |
| 129 | | python ci/semver_sort.py python-v \ |
| 130 | | tail -n 1) |
| 131 | else |
| 132 | echo "This is a stable release" |
| 133 | # Get last stable tag (ignore betas) |
| 134 | FROM_TAG=$(git tag --sort='version:refname' \ |
| 135 | | grep ^python-v \ |
| 136 | | grep -vF "$TAG" \ |
| 137 | | grep -v beta \ |
| 138 | | python ci/semver_sort.py python-v \ |
| 139 | | tail -n 1) |
| 140 | fi |
| 141 | echo "Found from tag $FROM_TAG" |
| 142 | echo "from_tag=$FROM_TAG" >> $GITHUB_OUTPUT |
| 143 | - name: Create Python Release Notes |
| 144 | id: python_release_notes |
| 145 | uses: mikepenz/release-changelog-builder-action@v4 |
| 146 | with: |
| 147 | configuration: .github/release_notes.json |
| 148 | toTag: ${{ steps.extract_version.outputs.tag }} |
| 149 | fromTag: ${{ steps.extract_version.outputs.from_tag }} |
| 150 | env: |
| 151 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 152 | - name: Create Python GH release |
| 153 | uses: softprops/action-gh-release@v2 |
| 154 | with: |
| 155 | prerelease: ${{ contains('beta', github.ref) }} |
| 156 | tag_name: ${{ steps.extract_version.outputs.tag }} |
| 157 | token: ${{ secrets.GITHUB_TOKEN }} |
| 158 | generate_release_notes: false |
| 159 | name: Python LanceDB v${{ steps.extract_version.outputs.version }} |
| 160 | body: ${{ steps.python_release_notes.outputs.changelog }} |