Files
lancedb/.github/workflows/publish-cli-installer.yml
T
Bruno Ramirez 72b46439bf ci: publish and verify the CLI shell installer (#5090)
#5082 added the CLI installer, but users still needed a repository
checkout to run the script. This PR publishes it at
`https://downloads.lancedb.com/cli/install.sh` whenever
`scripts/install.sh` changes on `main`. The installer continues to fetch
binaries and checksums from GitHub Releases.

This was accomplished with the following changes:

- Serialize publishes and check out current `main` so retrying an old
run picks up the current script.
- Use GitHub OIDC to upload the installer to S3, invalidate its
CloudFront path, and compare the public download byte for byte with the
checked-out script.
- Allow a manual run on `main` for the first publish and retries. The
first run requires the `CLI_INSTALLER_AWS_ROLE_ARN` and
`CLI_INSTALLER_DISTRIBUTION_ID` repository variables.

### Testing

The installer failure-case tests passed. With simulated AWS and HTTP
responses, the publish step accepted matching bytes, rejected a stale
download, and stopped before upload when the distribution ID was
missing.
2026-11-18 15:38:02 -08:00

49 lines
1.8 KiB
YAML

name: Publish CLI installer
on:
push:
branches: [main]
paths:
- scripts/install.sh
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
if: github.repository == 'lancedb/lancedb' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
concurrency:
group: publish-cli-installer
cancel-in-progress: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Queued jobs and retries publish the installer currently on main.
ref: refs/heads/main
persist-credentials: false
- uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
aws-region: us-west-2
role-to-assume: ${{ vars.CLI_INSTALLER_AWS_ROLE_ARN }}
- name: Publish and verify the installer
shell: bash
env:
DISTRIBUTION_ID: ${{ vars.CLI_INSTALLER_DISTRIBUTION_ID }}
run: |
: "${DISTRIBUTION_ID:?Set CLI_INSTALLER_DISTRIBUTION_ID before publishing}"
key=cli/install.sh
aws s3api put-object --bucket lancedb-downloads --key "$key" \
--body scripts/install.sh --content-type 'text/plain; charset=utf-8' \
--cache-control 'public, max-age=0, must-revalidate' > /dev/null
invalidation=$(aws cloudfront create-invalidation --distribution-id "$DISTRIBUTION_ID" \
--paths "/$key" --query Invalidation.Id --output text)
aws cloudfront wait invalidation-completed --distribution-id "$DISTRIBUTION_ID" --id "$invalidation"
curl --fail --silent --show-error --retry 3 "https://downloads.lancedb.com/$key" \
--output "$RUNNER_TEMP/published-installer.sh"
cmp scripts/install.sh "$RUNNER_TEMP/published-installer.sh"