-
Notifications
You must be signed in to change notification settings - Fork 6
72 lines (58 loc) · 1.96 KB
/
docs-publish.yml
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
name: Generate documentation
on:
# Workflow dispatch is used for manual triggers
workflow_dispatch:
# Workflow call is used for called from another workflow
workflow_call:
env:
GITHUB_PAGES_BRANCH: gh-pages
jobs:
publish-docs:
runs-on: ubuntu-24.04
environment:
name: docs-prod
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
run: pipx install poetry==1.8.4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'poetry'
- name: Check pyproject.toml validity
run: poetry check --no-interaction
- name: Install deps
run: poetry install --no-interaction
- name: Generate CLI reference
run: |
cd src
poetry run python generate_docs.py > ../docs/docs/about/getting_started/cli/cli_reference.md
- name: Generate JSON Schema
run: |
cd src
poetry run python generate_json_schema.py > ../docs/docs/about/getting_started/yaml/ecalc_json_schema.json
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies and build website
run: |
cd docs
npm ci --ignore-scripts
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