-
Notifications
You must be signed in to change notification settings - Fork 4
186 lines (158 loc) · 5.09 KB
/
deploy-to-github-pages.yml
File metadata and controls
186 lines (158 loc) · 5.09 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Deploy to GitHub Pages
on:
push:
branches:
- main
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Linting job
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.13
cache: 'pip'
- name: Install dependencies
run: pip install --requirement requirements.txt --requirement requirements-freeze.txt
- name: Lint
run: mdwrap --check docs
# Build Material for MkDocs job
build-material-for-mkdocs:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: 3.13
cache: pip
- uses: actions/cache@v4
with:
key: ${{ github.ref }}
path: .cache
- name: Install Material for MkDocs dependencies
run: |
sudo apt install --yes \
libcairo2-dev \
libfreetype6-dev \
libffi-dev \
libjpeg-dev \
libpng-dev \
libz-dev
pip install \
cairosvg \
mkdocs-material \
mkdocs-minify-plugin \
mkdocs-git-revision-date-localized-plugin \
mkdocs-glightbox \
pillow
- name: Build Material for MkDocs
run: |
mkdocs build --site-dir public
- name: Upload files
uses: actions/upload-artifact@v4
with:
name: material-for-mkdocs-files
path: |
public
if-no-files-found: error
retention-days: 1
# Build Marp job
build-marp:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build presentation (content) with Marp (HTML)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: --config .github/workflows/marp.config.js --html --output "presentation/index.html" "presentation/README.md"
env:
MARP_USER: root:root
- name: Build presentation (about us) with Marp (HTML)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: --config .github/workflows/marp.config.js --html --output "presentation/about.html" "presentation/ABOUT.md"
env:
MARP_USER: root:root
- name: Build presentation (content) with Marp (PDF)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: --config .github/workflows/marp.config.js --html --allow-local-files --jpeg-quality 100 --pdf --output "presentation/a-guide-to-mlops-presentation.pdf" "presentation/README.md"
env:
MARP_USER: root:root
- name: Build presentation (about us) with Marp (PDF)
uses: docker://marpteam/marp-cli:v3.0.2
with:
args: --config .github/workflows/marp.config.js --html --allow-local-files --jpeg-quality 100 --pdf --output "presentation/a-guide-to-mlops-about-us.pdf" "presentation/ABOUT.md"
env:
MARP_USER: root:root
- name: Upload files
uses: actions/upload-artifact@v4
with:
name: marp-files
path: |
presentation/images
presentation/a-guide-to-mlops-presentation.pdf
presentation/a-guide-to-mlops-about-us.pdf
presentation/index.html
presentation/about.html
if-no-files-found: error
retention-days: 1
merge-files-for-github-pages:
runs-on: ubuntu-latest
needs: [build-material-for-mkdocs, build-marp]
steps:
- name: Download files
uses: actions/download-artifact@v4
with:
pattern: "*-files"
- name: Merge files
run: |
# Copy Material for MkDocs files to the `public` directory
mv material-for-mkdocs-files public
# Check if the `presentation` directory exists in the `public` directory
if [ -d "presentation" ]; then
echo "The 'presentation' directory already exists in the `public` directory"
exit 1
fi
# Move the Marp files to the `presentation` directory
mv marp-files public/presentation
- name: Upload files to GitHub Pages
# Only run on main
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# Deployment job
deploy:
runs-on: ubuntu-latest
needs: merge-files-for-github-pages
# Only run on main
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4