-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·161 lines (156 loc) · 4.67 KB
/
deploy-docs.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Build and Deploy
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install mdbtools
run: |
sudo apt-get update
sudo apt-get install -y mdbtools
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "export PATH=$HOME/.local/bin:\$PATH" >> $GITHUB_ENV
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Node.js dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Node.js dependencies
run: |
npm install
- name: Install dependencies
run: |
poetry install
- name: Build Sphinx documentation
run: |
poetry run sphinx-build -b html docs/source docs/build/html
- name: Upload documentation as artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build/html
deploy-docs:
needs: build-docs
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Download documentation artifact
uses: actions/download-artifact@v4
with:
name: docs
path: docs/build/html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
build-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install mdbtools
run: |
sudo apt-get update
sudo apt-get install -y mdbtools
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "export PATH=$HOME/.local/bin:\$PATH" >> $GITHUB_ENV
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: |
poetry install
- name: Build Schema
run: |
poetry run python schema/build_schema.py
- name: Upload Schema as artifact
uses: actions/upload-artifact@v4
with:
name: schema
path: schema
deploy-schema:
needs: build-schema
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Download Schema artifact
uses: actions/download-artifact@v4
with:
name: schema
path: schema_new
- name: Set up Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Fetch and create schema branch if it doesn't exist
run: |
git fetch origin schema || git checkout --orphan schema
git switch schema || git checkout -b schema
if [ "$(git rev-parse --abbrev-ref HEAD)" != "schema" ]; then
git switch -c schema
rm -rf ./*
mkdir -p schema
touch schema/.gitkeep
git add schema/.gitkeep
git commit -m "Initialize schema branch with schema folder"
git push -u origin schema
fi
- name: Copy schema artifact to schema folder
run: |
rm -rf schema/* # Clear existing files in schema folder
cp -R schema_new/* schema/ # Copy new schema files to schema folder
- name: Commit and push schema updates
run: |
git add schema
git commit -m "Update schema files" || echo "No changes to commit"
git push origin schema