blob: 1084cf6f0777a24eb07e7d1d058e11d2e9c526c3 [file] [log] [blame]
Davide Pesavento6b2bb622023-01-12 22:00:44 -05001name: Publish
2on:
3 push:
4 branches:
5 - master
6 paths-ignore:
7 - '.mailmap'
8 - 'README.md'
9 workflow_dispatch:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050010 inputs:
11 skip-deploy:
12 description: 'Skip deployment?'
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050013 type: boolean
Davide Pesavento6b2bb622023-01-12 22:00:44 -050014
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050015permissions: {}
Davide Pesavento6b2bb622023-01-12 22:00:44 -050016
Davide Pesaventoe8574692023-02-16 16:20:22 -050017env:
18 SPHINXOPTS: --color
19
Davide Pesavento6b2bb622023-01-12 22:00:44 -050020jobs:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050021 html:
Davide Pesavento6b2bb622023-01-12 22:00:44 -050022 runs-on: ubuntu-latest
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050023 outputs:
24 version: ${{ steps.version.outputs.version }}
Davide Pesavento6b2bb622023-01-12 22:00:44 -050025 steps:
Davide Pesaventoe8574692023-02-16 16:20:22 -050026 - name: Checkout repository
Davide Pesavento6b2bb622023-01-12 22:00:44 -050027 uses: actions/checkout@v3
28 - name: Extract version
29 id: version
30 run: |
31 v=$(sed -nE "s/^version\s*=\s*['\"]([0-9]+(\.[0-9]+){0,3})['\"]/\1/p" conf.py)
32 if [[ -z $v ]]; then
33 echo "::error::Could not find a valid version in conf.py"
34 exit 1
35 fi
Davide Pesavento6b2bb622023-01-12 22:00:44 -050036 echo "version=$v" >> $GITHUB_OUTPUT
37 - name: Set up Python
38 uses: actions/setup-python@v4
39 with:
Davide Pesaventoc73673d2023-02-16 16:34:11 -050040 python-version: '3.11'
Davide Pesavento6b2bb622023-01-12 22:00:44 -050041 - name: Install dependencies
42 run: |
43 python -m pip install --upgrade pip
Davide Pesaventoc73673d2023-02-16 16:34:11 -050044 python -m pip install -r requirements.txt
Davide Pesavento6b2bb622023-01-12 22:00:44 -050045 - name: Generate HTML pages
Davide Pesaventoe8574692023-02-16 16:20:22 -050046 run: |
47 export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
48 make html
Davide Pesavento6b2bb622023-01-12 22:00:44 -050049 - name: Publish HTML pages
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050050 uses: actions/upload-artifact@v3
Davide Pesavento6b2bb622023-01-12 22:00:44 -050051 with:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050052 name: ndn-packet-spec-html
53 path: _build/html
54 if-no-files-found: error
Davide Pesavento16c9fd22023-01-17 22:08:10 -050055
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050056 pdf:
Davide Pesavento16c9fd22023-01-17 22:08:10 -050057 runs-on: ubuntu-latest
58 steps:
Davide Pesaventoe8574692023-02-16 16:20:22 -050059 - name: Checkout repository
Davide Pesavento16c9fd22023-01-17 22:08:10 -050060 uses: actions/checkout@v3
61 - name: Set up Python
62 uses: actions/setup-python@v4
63 with:
Davide Pesaventoc73673d2023-02-16 16:34:11 -050064 python-version: '3.11'
Davide Pesavento16c9fd22023-01-17 22:08:10 -050065 - name: Install dependencies
66 run: |
67 sudo apt-get -qq update
68 sudo apt-get -qy install --no-install-recommends latexmk \
69 texlive-latex-extra texlive-fonts-recommended tex-gyre
70 python -m pip install --upgrade pip
Davide Pesaventoc73673d2023-02-16 16:34:11 -050071 python -m pip install -r requirements.txt
Davide Pesavento16c9fd22023-01-17 22:08:10 -050072 - name: Generate PDF document
Davide Pesaventoe8574692023-02-16 16:20:22 -050073 run: |
74 export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
75 make latexpdf
Davide Pesavento16c9fd22023-01-17 22:08:10 -050076 - name: Publish PDF document
77 uses: actions/upload-artifact@v3
78 with:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050079 name: ndn-packet-spec-pdf
Davide Pesavento16c9fd22023-01-17 22:08:10 -050080 path: _build/latex/ndn-packet-spec.pdf
81 if-no-files-found: error
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050082
83 deploy:
84 if: github.ref_name == 'master' && !inputs.skip-deploy
85 needs: html
86 uses: named-data/actions/.github/workflows/docs-deployment.yml@v1
87 with:
88 artifact-name: ndn-packet-spec-html
89 version: ${{ needs.html.outputs.version }}
90 secrets: inherit