-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (106 loc) · 3.65 KB
/
Copy pathdocs.yml
File metadata and controls
120 lines (106 loc) · 3.65 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Docs
on:
push:
tags:
- 'v*.*.*'
pull_request:
paths:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'scripts/public/resolve-docs-version.mjs'
workflow_dispatch:
inputs:
tag:
description: 'Optional release tag to publish, e.g. v0.7.2. Defaults to the latest release tag.'
required: false
type: string
permissions:
contents: read
concurrency:
group: docs-pages
cancel-in-progress: false
jobs:
build:
name: build docs
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout source
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- name: Resolve docs version
id: docs_version
env:
RELEASE_TAG_INPUT: ${{ inputs.tag }}
run: node scripts/public/resolve-docs-version.mjs
- name: Set up Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
package-manager-cache: false
- name: Install docs dependencies
run: npm ci
working-directory: docs
- name: Build docs
run: npm run build
working-directory: docs
env:
ASTRO_TELEMETRY_DISABLED: 1
PUBLIC_BIFROST_VERSION: ${{ steps.docs_version.outputs.version }}
PUBLIC_BIFROST_TAG: ${{ steps.docs_version.outputs.tag }}
PUBLIC_BIFROST_RELEASE_URL: ${{ steps.docs_version.outputs.release_url }}
PUBLIC_DOCS_SITE: https://bifrost.brokk.ai
PUBLIC_DOCS_BASE: /
- name: Prepare Pages artifact
if: github.event_name != 'pull_request'
shell: bash
env:
DOCS_IS_RELEASE: ${{ steps.docs_version.outputs.is_release }}
DOCS_RELEASE_TAG: ${{ steps.docs_version.outputs.tag }}
run: |
set -euo pipefail
rm -rf .publish
mkdir -p .publish
cp -a docs/dist/. .publish/
if [ "${DOCS_IS_RELEASE}" = "true" ]; then
PUBLIC_BIFROST_VERSION="${DOCS_RELEASE_TAG#v}" \
PUBLIC_BIFROST_TAG="${DOCS_RELEASE_TAG}" \
PUBLIC_BIFROST_RELEASE_URL="https://github.com/BrokkAi/bifrost/releases/tag/${DOCS_RELEASE_TAG}" \
PUBLIC_DOCS_SITE="https://bifrost.brokk.ai" \
PUBLIC_DOCS_BASE="/versions/${DOCS_RELEASE_TAG}" \
ASTRO_TELEMETRY_DISABLED=1 \
npm run build --prefix docs
mkdir -p ".publish/versions/${DOCS_RELEASE_TAG}"
cp -a docs/dist/. ".publish/versions/${DOCS_RELEASE_TAG}/"
fi
node <<'NODE'
const { writeFileSync } = require('node:fs');
const tag = process.env.DOCS_RELEASE_TAG || '';
const versions = tag ? [tag] : [];
writeFileSync('.publish/versions.json', `${JSON.stringify({ latest: versions[0] ?? null, versions }, null, 2)}\n`);
NODE
touch .publish/.nojekyll
- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: .publish
deploy:
name: deploy docs
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5