-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 3.88 KB
/
Copy pathdeploy-artifacts.yml
File metadata and controls
133 lines (112 loc) · 3.88 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
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Deploy artifacts
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'exercises/**'
- 'slides/**'
- '.github/workflows/deploy-artifacts.yml'
- 'pyproject.toml'
- 'poetry.lock'
- 'package.json'
- 'package-lock.json'
env:
BASE_URL: ""
EXERCISES_DIR: "exercises/"
EXTRAS_BUILD_DIR: "docs/_build/html/extras"
SITE_BUILD_DIR: "docs/_build/html"
EXTRAS_URL: "https://database-development.erhardt.consulting/extras"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Install NodeJS 22.x
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22.x
- name: Cache NodeJS environment
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
**/node_modules
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node
- name: Install NodeJS dependencies
run: npm ci
- name: Set up python
id: setup-python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.14'
- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction
- name: Build page
run: |
source .venv/bin/activate
cd docs/
jupyter book build --html --ci
- name: Convert exercises
run: |
find "${EXERCISES_DIR}" -type f -name "*.md" | while read file; do
dir=$(dirname "$file")
base_dir=$(basename "$dir")
filename=$(basename "$file" .md)
target_dir="${EXTRAS_BUILD_DIR}/exercises/${base_dir}"
mkdir -p "${target_dir}"
echo "Processing $file -> ${target_dir}/${filename}.pdf"
podman run --rm -v "$(pwd):/data" docker.io/pandoc/extra \
--template eisvogel \
-f markdown \
-t pdf \
"/data/${file}" \
-o "/data/${target_dir}/${filename}.pdf"
done
- name: Convert slides
run: |
npm run slides:pdf
mkdir -p "${EXTRAS_BUILD_DIR}/slides"
cp -r slides/_build/*.pdf "${EXTRAS_BUILD_DIR}/slides"
- name: Build extras index page
run: |
source .venv/bin/activate
cd "${SITE_BUILD_DIR}"
linuxdir2html --links --protocol "${EXTRAS_URL}" ./extras ./extras/index
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: './docs/_build/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4