Repository navigation
105 lines (96 loc) · 3.67 KB
/
Copy pathdocs.yml
File metadata and controls
105 lines (96 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: docs
on:
workflow_call:
secrets:
DATABASE_URL:
required: false
OPENAI_API_KEY:
required: false
TS_OAUTH_CLIENT_ID:
required: false
TS_AUDIENCE:
required: false
workflow_dispatch:
inputs:
publish:
description: I verified the matching docs deployment and a restorable index backup
type: boolean
required: true
default: false
deployed_revision:
description: Full source SHA of the verified serving docs deployment
type: string
required: true
deployment_id:
description: Verified serving docs deployment ID
type: string
required: true
backup_reference:
description: Restorable docs_embeddings backup identifier (no credentials)
type: string
required: true
permissions:
contents: read
jobs:
embeddings:
name: embeddings
# Network-bound on the embeddings API: ~9% CPU and ~3% peak memory on 8 vCPU.
runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 30
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' && inputs.publish
concurrency:
group: docs-search-index-production
cancel-in-progress: false
permissions:
contents: read
# Tailscale workload identity federation exchanges this job's OIDC token.
id-token: write
steps:
- name: Record verified deployment and backup
env:
DEPLOYED_REVISION: ${{ inputs.deployed_revision }}
DEPLOYMENT_ID: ${{ inputs.deployment_id }}
BACKUP_REFERENCE: ${{ inputs.backup_reference }}
run: |
test "$DEPLOYED_REVISION" = "$GITHUB_SHA"
test -n "$DEPLOYMENT_ID"
test -n "$BACKUP_REFERENCE"
jq -n --arg revision "$DEPLOYED_REVISION" --arg deployment "$DEPLOYMENT_ID" \
--arg backup "$BACKUP_REFERENCE" --arg actor "$GITHUB_ACTOR" \
'{revision: $revision, deploymentId: $deployment, backupReference: $backup, verifiedBy: $actor}' \
> "$RUNNER_TEMP/docs-search-authorization.json"
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Setup workspace
uses: ./.github/actions/setup
with:
provider: ${{ vars.CI_PROVIDER }}
node-version: '24'
# Database IP restrictions admit the tailnet's app connector; see migrate.yml.
- name: Join the tailnet
if: vars.CI_DB_TAILNET == 'true'
uses: tailscale/github-action@064b10558093f38325e838ddea35486bdc6b1d5c # v4.4.0
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
audience: ${{ secrets.TS_AUDIENCE }}
tags: tag:ci
- name: Process docs embeddings
working-directory: ./apps/docs
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
bun run content:generate
DOCS_SEARCH_REPORT_PATH=test-results/docs-search-publish.json bun run scripts/index-search.ts
DOCS_SEARCH_REPORT_PATH=test-results/docs-search-check.json bun run scripts/index-search.ts --check
- name: Upload search index report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: docs-search-index
path: |
apps/docs/test-results/docs-search-*.json
${{ runner.temp }}/docs-search-authorization.json