-
Notifications
You must be signed in to change notification settings - Fork 10
73 lines (58 loc) · 2.06 KB
/
Copy pathpublish-docs.yml
File metadata and controls
73 lines (58 loc) · 2.06 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
name: Generate and publish documentation
on:
workflow_dispatch:
workflow_call:
permissions: { }
env:
GITHUB_PAGES_BRANCH: gh-pages
jobs:
publish-docs:
permissions:
contents: write # Needed to push to gh-pages branch
runs-on: ubuntu-24.04
environment:
name: docs-prod
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Generate CLI reference
run: |
uv run typer src/ecalc_cli/main.py utils docs > ./docs/docs/about/getting_started/cli/cli_reference.md
- name: Generate JSON Schema
run: |
cd src
uv run python generate_json_schema.py > ../docs/docs/about/getting_started/yaml/ecalc_json_schema.json
- name: Setup node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
working-directory: ./docs
run: npm ci --ignore-scripts
- name: Build website
working-directory: ./docs
run: npm run build
- name: Push static files to Github Pages branch
run: |
cd docs/build
CREATED_FROM_REF=$(git rev-parse --short HEAD)
git init
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git checkout -b $GITHUB_PAGES_BRANCH
git remote add $GITHUB_PAGES_BRANCH https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/equinor/ecalc
git add .
git commit -m "Built from commit '$CREATED_FROM_REF'"
git push -f --set-upstream gh-pages gh-pages