Skip to content

Commit

Permalink
fix docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
itaysk committed Nov 7, 2024
1 parent d3e7415 commit 357f5cc
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.4.2-insiders-4.42.0
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.44-insiders-4.53.14
pip install -r docs/build/requirements.txt
env:
GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.44-insiders-4.53.14
pip install -r docs/build/requirements.txt
env:
GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }}
Expand Down
1 change: 1 addition & 0 deletions docs/build/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mkdocs-material
mkdocs-macros-plugin
37 changes: 31 additions & 6 deletions docs/build/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,51 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# pip-compile
# pip-compile --output-file=docs/build/requirements.txt docs/build/requirements.in
#
certifi==2024.8.30
# via requests
charset-normalizer==3.4.0
# via requests
click==8.1.2
# via mkdocs
ghp-import==2.0.2
# via mkdocs
idna==3.10
# via requests
importlib-metadata==4.11.3
# via mkdocs
jinja2==3.1.1
# via
# mkdocs
# mkdocs-macros-plugin
# mkdocs-material
markdown==3.3.6
# via mkdocs
# via
# mkdocs
# mkdocs-material
# pymdown-extensions
markupsafe==2.1.1
# via jinja2
mergedeep==1.3.4
# via mkdocs
mkdocs==1.3.0
# via mkdocs-macros-plugin
# via
# mkdocs-macros-plugin
# mkdocs-material
mkdocs-macros-plugin==0.7.0
# via -r requirements.in
# via -r docs/build/requirements.in
mkdocs-material==8.5.4
# via -r docs/build/requirements.in
mkdocs-material-extensions==1.3.1
# via mkdocs-material
packaging==21.3
# via mkdocs
pygments==2.18.0
# via mkdocs-material
pymdown-extensions==10.4
# via mkdocs-material
pyparsing==3.0.8
# via packaging
python-dateutil==2.8.2
Expand All @@ -36,14 +56,19 @@ pyyaml==6.0.1
# via
# mkdocs
# mkdocs-macros-plugin
# pymdown-extensions
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
requests==2.32.3
# via mkdocs-material
six==1.16.0
# via python-dateutil
termcolor==1.1.0
# via mkdocs-macros-plugin
urllib3==2.2.3
# via requests
watchdog==2.1.7
# via mkdocs
zipp==3.8.0
# via importlib-metadata
# via importlib-metadata
14 changes: 11 additions & 3 deletions magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,29 @@ func Label() error {

type Docs mg.Namespace

// Compile Sass to CSS
// Prepare CSS
func (Docs) Css() error {
const (
homepageSass = "docs/assets/css/trivy_v1_homepage.scss"
)
return sh.Run("sass", "--no-source-map", "--style=compressed", homepageSass, strings.TrimSuffix(homepageSass, ".scss")+".min.css")
}

// Prepare python requirements
func (Docs) Pip() error {
const (
requirementsIn = "docs/build/requirements.in"
)
return sh.Run("pip-compile", requirementsIn, "--output-file", strings.TrimSuffix(requirementsIn, ".in")+".txt")
}

// Serve launches MkDocs development server to preview the documentation page
func (Docs) Serve() error {
const (
mkdocsImage = "squidfunk/mkdocs-material:9.5"
mkdocsImage = "squidfunk/mkdocs-material:9.5.44"
mkdocsPort = "8000"
)
if err := sh.Run("docker", "build", "-t", mkdocsImage, "-f", "docs/build/Dockerfile", "docs/build"); err != nil {
if err := sh.Run("docker", "build", "-t", mkdocsImage, "docs/build"); err != nil {
return err
}
return sh.Run("docker", "run", "--name", "mkdocs-serve", "--rm", "-v", "${PWD}:/docs", "-p", mkdocsPort+":8000", mkdocsImage)
Expand Down

0 comments on commit 357f5cc

Please sign in to comment.