blob: 3ecdfca44e02e27a2435157342cb9a101f40f6d4 [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?'
13 required: true
14 type: boolean
Davide Pesavento6b2bb622023-01-12 22:00:44 -050015
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050016permissions: {}
Davide Pesavento6b2bb622023-01-12 22:00:44 -050017
Davide Pesaventoe8574692023-02-16 16:20:22 -050018env:
19 SPHINXOPTS: --color
20
Davide Pesavento6b2bb622023-01-12 22:00:44 -050021jobs:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050022 html:
Davide Pesavento6b2bb622023-01-12 22:00:44 -050023 runs-on: ubuntu-latest
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050024 outputs:
25 version: ${{ steps.version.outputs.version }}
Davide Pesavento6b2bb622023-01-12 22:00:44 -050026 steps:
Davide Pesaventoe8574692023-02-16 16:20:22 -050027 - name: Checkout repository
Davide Pesavento6b2bb622023-01-12 22:00:44 -050028 uses: actions/checkout@v3
29 - name: Extract version
30 id: version
31 run: |
32 v=$(sed -nE "s/^version\s*=\s*['\"]([0-9]+(\.[0-9]+){0,3})['\"]/\1/p" conf.py)
33 if [[ -z $v ]]; then
34 echo "::error::Could not find a valid version in conf.py"
35 exit 1
36 fi
Davide Pesavento6b2bb622023-01-12 22:00:44 -050037 echo "version=$v" >> $GITHUB_OUTPUT
38 - name: Set up Python
39 uses: actions/setup-python@v4
40 with:
41 python-version: '3.10'
42 - name: Install dependencies
43 run: |
44 python -m pip install --upgrade pip
45 pip install -r requirements.txt
46 - name: Generate HTML pages
Davide Pesaventoe8574692023-02-16 16:20:22 -050047 run: |
48 export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
49 make html
Davide Pesavento6b2bb622023-01-12 22:00:44 -050050 - name: Publish HTML pages
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050051 uses: actions/upload-artifact@v3
Davide Pesavento6b2bb622023-01-12 22:00:44 -050052 with:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050053 name: ndn-packet-spec-html
54 path: _build/html
55 if-no-files-found: error
Davide Pesavento16c9fd22023-01-17 22:08:10 -050056
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050057 pdf:
Davide Pesavento16c9fd22023-01-17 22:08:10 -050058 runs-on: ubuntu-latest
59 steps:
Davide Pesaventoe8574692023-02-16 16:20:22 -050060 - name: Checkout repository
Davide Pesavento16c9fd22023-01-17 22:08:10 -050061 uses: actions/checkout@v3
62 - name: Set up Python
63 uses: actions/setup-python@v4
64 with:
65 python-version: '3.10'
66 - name: Install dependencies
67 run: |
68 sudo apt-get -qq update
69 sudo apt-get -qy install --no-install-recommends latexmk \
70 texlive-latex-extra texlive-fonts-recommended tex-gyre
71 python -m pip install --upgrade pip
72 pip install -r requirements.txt
73 - name: Generate PDF document
Davide Pesaventoe8574692023-02-16 16:20:22 -050074 run: |
75 export SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
76 make latexpdf
Davide Pesavento16c9fd22023-01-17 22:08:10 -050077 - name: Publish PDF document
78 uses: actions/upload-artifact@v3
79 with:
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050080 name: ndn-packet-spec-pdf
Davide Pesavento16c9fd22023-01-17 22:08:10 -050081 path: _build/latex/ndn-packet-spec.pdf
82 if-no-files-found: error
Davide Pesaventoc0bab4e2023-02-03 18:20:25 -050083
84 deploy:
85 if: github.ref_name == 'master' && !inputs.skip-deploy
86 needs: html
87 uses: named-data/actions/.github/workflows/docs-deployment.yml@v1
88 with:
89 artifact-name: ndn-packet-spec-html
90 version: ${{ needs.html.outputs.version }}
91 secrets: inherit