Build documentation #468
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build documentation | |
on: | |
pull_request: | |
push: | |
branches: | |
- '*' | |
tags: | |
- v* | |
workflow_dispatch: | |
schedule: | |
- cron: '25 7 * * 0' | |
jobs: | |
build-html-man-pdf: | |
runs-on: ubuntu-latest | |
name: Build documentation | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set release/tag | |
run: | | |
git describe --tags --long --always > RELEASE || true | |
git describe --tags --exact-match > TAG || true | |
- name: Build | |
uses: docker://docker.io/sphinxdoc/sphinx-latexpdf:latest | |
with: | |
entrypoint: make | |
args: html man latexpdf | |
- name: Archive artifacts (html) | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'push' | |
with: | |
name: html | |
path: _build/html | |
retention-days: 14 | |
- name: Archive artifacts (man) | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'push' | |
with: | |
name: man | |
path: _build/man | |
retention-days: 14 | |
- name: Archive artifacts (pdf) | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'push' | |
with: | |
name: pdf | |
path: _build/latex/*.pdf | |
retention-days: 14 | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish to GitHub pages | |
needs: build-html-man-pdf | |
environment: github-pages | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare site (pre-rendered) | |
run: | | |
git clone --depth 1 https://github.com/syncthing/docs-pre-rendered.git _site | |
rm -rf _site/.git | |
go run _script/lsver.go _site > _site/versions.json | |
- name: Prepare site (html) | |
uses: actions/download-artifact@v4 | |
with: | |
name: html | |
path: _site | |
- name: Prepare site (man) | |
uses: actions/download-artifact@v4 | |
with: | |
name: man | |
path: _site/man | |
- name: Prepare site (pdf) | |
uses: actions/download-artifact@v4 | |
with: | |
name: man | |
path: _site/man | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |