From 72b46439bf0a4b8708a0e37af26a66cb909dfa37 Mon Sep 17 00:00:00 2001 From: Bruno Ramirez Date: Wed, 18 Nov 2026 15:38:02 -0800 Subject: [PATCH] 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. --- .github/workflows/publish-cli-installer.yml | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/publish-cli-installer.yml diff --git a/.github/workflows/publish-cli-installer.yml b/.github/workflows/publish-cli-installer.yml new file mode 100644 index 000000000..6b73e2fc1 --- /dev/null +++ b/.github/workflows/publish-cli-installer.yml @@ -0,0 +1,48 @@ +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"