99 lines
3.0 KiB
YAML
99 lines
3.0 KiB
YAML
name: "Push Docs"
|
|
|
|
on:
|
|
push:
|
|
branches: [docs-latest]
|
|
|
|
concurrency:
|
|
group: on-push-docs
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: "read"
|
|
id-token: "write"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash --noprofile --norc -euo pipefail {0}
|
|
|
|
jobs:
|
|
# Get latest release version from crates.io
|
|
# This excludes any prerelease builds, e.g. `0.15.0-alpha.1` or `rc` or similar.
|
|
# We get it from crates.io because it's the strongest indicator of the latest
|
|
# fully released version we have available, and there is no better way to retrieve
|
|
# that in the context of this branch, because we don't want to rely on the contents
|
|
# of a local `Cargo.toml` or the git branch name.
|
|
get-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.versioning.outputs.crate_version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: prefix-dev/setup-pixi@v0.10.0
|
|
with:
|
|
pixi-version: v0.71.3
|
|
|
|
- name: Get version
|
|
id: versioning
|
|
run: |
|
|
crate_version=$(pixi run python scripts/ci/crates.py get-version --from=cratesio --skip-prerelease)
|
|
echo "crate_version=$crate_version" >> "$GITHUB_OUTPUT"
|
|
|
|
build-search-index:
|
|
runs-on: ubuntu-latest-16-cores
|
|
needs: [get-version]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Rust
|
|
uses: ./.github/actions/setup-rust
|
|
with:
|
|
cache_key: "build-linux"
|
|
save_cache: false
|
|
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
|
|
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
|
|
|
|
- uses: prefix-dev/setup-pixi@v0.10.0
|
|
with:
|
|
pixi-version: v0.71.3
|
|
|
|
- name: Build search index
|
|
run: |
|
|
pixi run search-index build \
|
|
landing \
|
|
--url "https://ms-b22605aed932-7275.fra.meilisearch.io" \
|
|
--master-key "${{ secrets.MEILISEARCH_TOKEN }}" \
|
|
--release-version "${{ needs.get-version.outputs.version }}"
|
|
|
|
# The website reads prose from GCS at SSR time, so a `docs-latest`
|
|
# push takes effect via a GCS re-upload + ISR revalidate.
|
|
upload-prose:
|
|
name: Upload prose to GCS
|
|
runs-on: ubuntu-latest
|
|
needs: [get-version]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: prefix-dev/setup-pixi@v0.10.0
|
|
with:
|
|
pixi-version: v0.71.3
|
|
|
|
- id: "auth"
|
|
uses: google-github-actions/auth@v2
|
|
with:
|
|
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
|
|
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
|
|
|
|
- name: "Upload markdown docs & examples to GCS"
|
|
env:
|
|
ISR_BYPASS_TOKEN: ${{ secrets.ISR_BYPASS_TOKEN }}
|
|
VERSION_LABEL: ${{ needs.get-version.outputs.version }}
|
|
RERUN_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
pixi run uv run scripts/ci/upload_docs.py upload \
|
|
--version "$VERSION_LABEL" \
|
|
--rerun-commit "$RERUN_COMMIT" \
|
|
--mark-latest \
|
|
--purge-token "$ISR_BYPASS_TOKEN"
|