listmonk/.github/workflows/github-pages.yml
Kailash Nadh 684c15a404
Add static Hugo website and mkdocs documentation to docs directory. (#1261)
This commit merges the static website and docs that was on
https://github.com/knadh/listmonk-site repository into the main
listmonk repo.

It also adds a GitHub Actions workflow to public the sites on GitHub
Pages instead of Netlify.
2023-03-26 00:51:20 +05:30

55 lines
1.6 KiB
YAML

name: publish-github-pages
on:
push:
branches:
- docs
paths:
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs-material
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.68.3'
# Build the main site to the docs/publish directory. This will be the root (/) in gh-pages.
# The -d (output) path is relative to the -s (source) path
- name: Build main site
run: hugo -s docs/site -d ../publish --gc --minify
# Build the mkdocs documentation in the docs/publish/docs dir. This will be at (/docs)
# The -d (output) path is relative to the -f (source) path
- name: Build docs site
run: mkdocs build -f docs/docs/mkdocs.yml -d ../publish/docs
# Copy the static i18n app to the publish directory. This will be at (/i18n)
- name: Copy i18n site
run: cp -R docs/i18n docs/publish
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/publish
cname: listmonk.app
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'