Repository navigation
90 lines (83 loc) · 2.37 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
90 lines (83 loc) · 2.37 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
name: deploy docs site to Pages
on:
push:
branches:
- main
tags:
- "v*"
paths-ignore:
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
deploy:
description: "Deploy to GitHub Pages"
type: boolean
default: false
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 26
cache: npm
- name: Update npm
# Node.js bundles an older npm; use the current one, as in local development.
run: npm install -g npm@latest
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Install dependencies
run: npm ci
- name: Build with Astro
run: npm run docs:build
env:
ASTRO_TELEMETRY_DISABLED: 1
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/dist
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
if: success() && (startsWith( github.ref, 'refs/tags/v') || inputs.deploy == true)
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
# Recrawl the Algolia DocSearch index so the search finds the deployed pages
reindex:
needs: deploy
runs-on: ubuntu-latest
name: Recrawl search index
steps:
- name: Start the Algolia crawler
env:
CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_ID }}
CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_USER_ID }}
CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_API_KEY }}
run: >
curl --fail-with-body --silent --show-error -X POST
-u "$CRAWLER_USER_ID:$CRAWLER_API_KEY"
"https://crawler.algolia.com/api/1/crawlers/$CRAWLER_ID/reindex"