Skip to content

v9.0.1-exa.6

v9.0.1-exa.6 #8

Workflow file for this run

name: Publish Rust crate
on:
release:
# Use released instead of published, since we don't publish preview/beta
# versions. Users instead install them from the git repo.
types: [released]
workflow_dispatch:
inputs:
tag:
description: "Tag to publish (e.g., v1.0.0)"
required: true
type: string
env:
# This env var is used by Swatinem/rust-cache@v2 for the cache
# key, so we set it to make sure it is always consistent.
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-C debuginfo=0"
permissions:
contents: read
jobs:
build:
# Needs additional disk space for the full build.
runs-on: ubuntu-24.04-8x
permissions:
contents: read
id-token: write
timeout-minutes: 60
env:
# Need up-to-date compilers for kernels
CC: clang-18
CXX: clang++-18
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Check if stable release
id: check_version
run: |
# Get the tag from the event
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
TAG="${{ github.event.inputs.tag }}"
else
TAG="${{ github.ref_name }}"
fi
echo "Checking tag: $TAG"
# Skip if tag contains -beta or -rc (not a stable release)
if [[ "$TAG" == *-beta.* ]] || [[ "$TAG" == *-rc.* ]]; then
echo "Skipping cargo publish for non-stable version: $TAG"
echo "Only stable versions (without -beta or -rc) are published to crates.io"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Stable version detected: $TAG"
echo "skip=false" >> $GITHUB_OUTPUT
fi
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
if: steps.check_version.outputs.skip != 'true'
with:
workspaces: rust
- name: Verify and checkout specified tag
if: github.event_name == 'workflow_dispatch' && steps.check_version.outputs.skip != 'true'
run: |
TAG="${{ github.event.inputs.tag }}"
git fetch --all --tags
if git rev-parse "$TAG" >/dev/null 2>&1; then
git checkout "$TAG"
echo "Successfully checked out tag $TAG"
else
echo "Error: Tag $TAG does not exist"
echo "Available tags:"
git tag -l
exit 1
fi
- name: Install dependencies
if: steps.check_version.outputs.skip != 'true'
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
# Wait until https://github.com/rust-lang/crates-io-auth-action/issues/51 fixed
# - uses: rust-lang/crates-io-auth-action@v1
# id: auth
# lance-arrow-stats and lance-arrow-scalar are versioned with Arrow
# (currently 58.0.0) and released on Arrow's cadence, not Lance's, so
# they are excluded from the per-release publish. Bump and publish them
# explicitly when their source changes.
- name: Publish crates
if: steps.check_version.outputs.skip != 'true'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --workspace \
--exclude lance-arrow-stats \
--exclude lance-arrow-scalar \
--all-features
report-failure:
name: Report Workflow Failure
runs-on: ubuntu-latest
needs: [build]
if: always() && (github.event_name == 'release' || github.event_name == 'workflow_dispatch')
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: ./.github/actions/create-failure-issue
with:
job-results: ${{ toJSON(needs) }}
workflow-name: ${{ github.workflow }}