| name: Publish |
| on: |
| push: |
| branches: |
| - master |
| paths-ignore: |
| - '.mailmap' |
| - 'README.md' |
| workflow_dispatch: |
| inputs: |
| skip-deploy: |
| description: 'Skip deployment?' |
| type: boolean |
| |
| permissions: {} |
| |
| env: |
| SPHINXOPTS: --color |
| |
| jobs: |
| html: |
| runs-on: ubuntu-latest |
| outputs: |
| version: ${{ steps.version.outputs.version }} |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v3 |
| - name: Extract version |
| id: version |
| run: | |
| v=$(sed -nE "s/^version\s*=\s*['\"]([0-9]+(\.[0-9]+){0,3})['\"]/\1/p" conf.py) |
| if [[ -z $v ]]; then |
| echo "::error::Could not find a valid version in conf.py" |
| exit 1 |
| fi |
| echo "version=$v" >> $GITHUB_OUTPUT |
| - name: Set up Python |
| uses: actions/setup-python@v4 |
| with: |
| python-version: '3.11' |
| - name: Install dependencies |
| run: | |
| python -m pip install --upgrade pip |
| python -m pip install -r requirements.txt |
| - name: Generate HTML pages |
| run: | |
| export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)" |
| make html |
| - name: Publish HTML pages |
| uses: actions/upload-artifact@v3 |
| with: |
| name: ndn-packet-spec-html |
| path: _build/html |
| if-no-files-found: error |
| |
| pdf: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v3 |
| - name: Set up Python |
| uses: actions/setup-python@v4 |
| with: |
| python-version: '3.11' |
| - name: Install dependencies |
| run: | |
| sudo apt-get -qq update |
| sudo apt-get -qy install --no-install-recommends latexmk \ |
| texlive-latex-extra texlive-fonts-recommended tex-gyre |
| python -m pip install --upgrade pip |
| python -m pip install -r requirements.txt |
| - name: Generate PDF document |
| run: | |
| export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)" |
| make latexpdf |
| - name: Publish PDF document |
| uses: actions/upload-artifact@v3 |
| with: |
| name: ndn-packet-spec-pdf |
| path: _build/latex/ndn-packet-spec.pdf |
| if-no-files-found: error |
| |
| deploy: |
| if: github.ref_name == 'master' && !inputs.skip-deploy |
| needs: html |
| uses: named-data/actions/.github/workflows/docs-deployment.yml@v1 |
| with: |
| artifact-name: ndn-packet-spec-html |
| version: ${{ needs.html.outputs.version }} |
| secrets: inherit |