Skip to content

Commit

Permalink
enable mkdocs and deploy to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
hedzr committed Jun 3, 2024
1 parent 9144177 commit 2a37e80
Show file tree
Hide file tree
Showing 7 changed files with 1,694 additions and 1,648 deletions.
59 changes: 59 additions & 0 deletions .github/workflow/mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "ci | Publish docs via GitHub Pages"

on:
push:
branches:
- master
- main
- devel

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: |
pip install mkdocs-material
pip install mkdocs-git-authors-plugin
- run: mkdocs gh-deploy --force

# on:
# push:
# branches:
# - master

# jobs:
# build:
# name: Deploy docs
# runs-on: ubuntu-latest
# steps:
# - name: Checkout main
# uses: actions/checkout@v2

# - name: Deploy docs
# uses: mhausenblas/mkdocs-deploy-gh-pages@master
# # Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
# # See: https://github.com/marketplace/actions/deploy-mkdocs
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CUSTOM_DOMAIN: hedzr.com
# CONFIG_FILE: ./mkdocs.yml
# EXTRA_PACKAGES: build-base
# # GITHUB_DOMAIN: github.myenterprise.com
# REQUIREMENTS: ./requirements.txt
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
site/
.venv/
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SHELL := /bin/bash
GH_PAGE := docs
# hedzr.github.io

.PHONY: deploy
deploy:
cd $(GH_PAGE) && mkdocs gh-deploy --config-file ../mkdocs.yml --remote-branch master

# .PHONY: update-build-version
# update-build-version:
# git submodule update --remote --merge
# git add $(GH_PAGE)
# git commit -m "ci: update build version"

# .PHONY: publish
# publish: deploy update-build-version
# git push --no-verify

dev: preview
preview: live-preview
live-preview:
mkdocs serve --dev-addr 0.0.0.0:7317 --open --dirty

init-env:
python3 -m venv .venv && source .venv/bin/activate && pip install --upgrade pip
pip install mkdocs
Loading

0 comments on commit 2a37e80

Please sign in to comment.