8a21a212f8
Deploy Documentation / deploy (push) Has been cancelled
Canary / build-cli (push) Has been skipped
Canary / Upload Install Script (push) Has been skipped
Canary / bundle-desktop (push) Has been skipped
Canary / bundle-desktop-intel (push) Has been skipped
Canary / bundle-desktop-linux (push) Has been skipped
Canary / bundle-desktop-windows (push) Has been skipped
Canary / bundle-desktop-windows-cuda (push) Has been skipped
Canary / Release (push) Has been skipped
Cargo Deny / deny (push) Has been skipped
Unused Dependencies / machete (push) Has been skipped
Canary / Prepare Version (push) Failing after 1s
Live Provider Tests / check-fork (push) Failing after 0s
Create Minor Release PR / check-version-bump-pr (push) Has been skipped
Publish Ask AI Bot Docker Image / docker (push) Failing after 1s
Live Provider Tests / changes (push) Has been skipped
Scorecard supply-chain security / Scorecard analysis (push) Has been skipped
Publish Docker Image / docker (push) Failing after 1s
CI / changes (push) Failing after 8s
Create Minor Release PR / release (push) Has been skipped
Live Provider Tests / Smoke Tests (push) Has been cancelled
Live Provider Tests / Smoke Tests (Code Execution) (push) Has been cancelled
Live Provider Tests / Compaction Tests (push) Has been cancelled
CI / Build Rust Project on Windows (push) Has been cancelled
Live Provider Tests / Build Binary (push) Has been cancelled
CI / Lint Rust Code (push) Has been cancelled
CI / Check Generated Schemas are Up-to-Date (push) Has been cancelled
CI / Test and Lint Electron Desktop App (push) Has been cancelled
CI / Check Rust Code Format (push) Has been cancelled
CI / Build and Test Rust Project (push) Has been cancelled
CI / Check MSRV (push) Has been cancelled
119 lines
3.8 KiB
YAML
119 lines
3.8 KiB
YAML
name: Documentation Site Preview
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
paths:
|
|
- 'documentation/**'
|
|
|
|
concurrency:
|
|
group: docs-preview-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
env:
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.PAGES_PR_PREVIEW_CF_ACCOUNT_ID }}
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.PAGES_PR_PREVIEW_CF_API_TOKEN }}
|
|
CLOUDFLARE_PAGES_PROJECT_NAME: ${{ secrets.PAGES_PR_PREVIEW_CF_PAGES_PROJECT_NAME }}
|
|
steps:
|
|
- name: Checkout the branch
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
|
|
- name: Setup Node.js for docs build
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
cache-dependency-path: documentation/package-lock.json
|
|
|
|
- name: Install dependencies and build docs
|
|
working-directory: ./documentation
|
|
env:
|
|
INKEEP_API_KEY: ${{ secrets.INKEEP_API_KEY }}
|
|
INKEEP_INTEGRATION_ID: ${{ secrets.INKEEP_INTEGRATION_ID }}
|
|
INKEEP_ORG_ID: ${{ secrets.INKEEP_ORG_ID }}
|
|
TARGET_PATH: /
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Verify docs map was generated
|
|
working-directory: ./documentation
|
|
run: ./scripts/verify-build.sh
|
|
|
|
- name: Setup Node.js for Wrangler
|
|
if: env.CLOUDFLARE_API_TOKEN != ''
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Deploy preview to Cloudflare Pages
|
|
if: env.CLOUDFLARE_API_TOKEN != ''
|
|
id: cloudflare-pages
|
|
working-directory: ./documentation
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
output=$(npx --yes wrangler@latest pages deploy build \
|
|
--project-name="$CLOUDFLARE_PAGES_PROJECT_NAME" \
|
|
--branch="pr-$PR_NUMBER" \
|
|
--commit-dirty=true 2>&1 | tee /dev/stderr)
|
|
|
|
preview_url=$(echo "$output" | grep -Eo 'https://[^[:space:]]+' | tail -n 1)
|
|
if [ -z "$preview_url" ]; then
|
|
echo "Failed to find Cloudflare Pages preview URL in wrangler output" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "preview-url=$preview_url" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Comment preview URL
|
|
if: env.CLOUDFLARE_API_TOKEN != ''
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
env:
|
|
PREVIEW_URL: ${{ steps.cloudflare-pages.outputs.preview-url }}
|
|
with:
|
|
script: |
|
|
const marker = '<!-- documentation-site-preview -->';
|
|
const body = `${marker}\nDocumentation preview deployed: ${process.env.PREVIEW_URL}`;
|
|
|
|
const {owner, repo} = context.repo;
|
|
const issue_number = context.issue.number;
|
|
const {data: comments} = await github.rest.issues.listComments({
|
|
owner,
|
|
repo,
|
|
issue_number,
|
|
per_page: 100,
|
|
});
|
|
|
|
const existingComment = comments.find((comment) =>
|
|
comment.user.type === 'Bot' && comment.body?.includes(marker)
|
|
);
|
|
|
|
if (existingComment) {
|
|
await github.rest.issues.updateComment({
|
|
owner,
|
|
repo,
|
|
comment_id: existingComment.id,
|
|
body,
|
|
});
|
|
} else {
|
|
await github.rest.issues.createComment({
|
|
owner,
|
|
repo,
|
|
issue_number,
|
|
body,
|
|
});
|
|
}
|