Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 1 | name: Publish |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - master |
| 6 | paths-ignore: |
| 7 | - '.mailmap' |
| 8 | - 'README.md' |
| 9 | workflow_dispatch: |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 10 | inputs: |
| 11 | skip-deploy: |
| 12 | description: 'Skip deployment?' |
| 13 | required: true |
| 14 | type: boolean |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 15 | |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 16 | permissions: {} |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 17 | |
| 18 | jobs: |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 19 | html: |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 20 | runs-on: ubuntu-latest |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 21 | outputs: |
| 22 | version: ${{ steps.version.outputs.version }} |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 23 | steps: |
| 24 | - name: Checkout |
| 25 | uses: actions/checkout@v3 |
| 26 | - name: Extract version |
| 27 | id: version |
| 28 | run: | |
| 29 | v=$(sed -nE "s/^version\s*=\s*['\"]([0-9]+(\.[0-9]+){0,3})['\"]/\1/p" conf.py) |
| 30 | if [[ -z $v ]]; then |
| 31 | echo "::error::Could not find a valid version in conf.py" |
| 32 | exit 1 |
| 33 | fi |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 34 | echo "version=$v" >> $GITHUB_OUTPUT |
| 35 | - name: Set up Python |
| 36 | uses: actions/setup-python@v4 |
| 37 | with: |
| 38 | python-version: '3.10' |
| 39 | - name: Install dependencies |
| 40 | run: | |
| 41 | python -m pip install --upgrade pip |
| 42 | pip install -r requirements.txt |
| 43 | - name: Generate HTML pages |
| 44 | run: make html |
| 45 | env: |
| 46 | SPHINXOPTS: --color |
| 47 | - name: Publish HTML pages |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 48 | uses: actions/upload-artifact@v3 |
Davide Pesavento | 6b2bb62 | 2023-01-12 22:00:44 -0500 | [diff] [blame] | 49 | with: |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 50 | name: ndn-packet-spec-html |
| 51 | path: _build/html |
| 52 | if-no-files-found: error |
Davide Pesavento | 16c9fd2 | 2023-01-17 22:08:10 -0500 | [diff] [blame] | 53 | |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 54 | pdf: |
Davide Pesavento | 16c9fd2 | 2023-01-17 22:08:10 -0500 | [diff] [blame] | 55 | runs-on: ubuntu-latest |
| 56 | steps: |
| 57 | - name: Checkout |
| 58 | uses: actions/checkout@v3 |
| 59 | - name: Set up Python |
| 60 | uses: actions/setup-python@v4 |
| 61 | with: |
| 62 | python-version: '3.10' |
| 63 | - name: Install dependencies |
| 64 | run: | |
| 65 | sudo apt-get -qq update |
| 66 | sudo apt-get -qy install --no-install-recommends latexmk \ |
| 67 | texlive-latex-extra texlive-fonts-recommended tex-gyre |
| 68 | python -m pip install --upgrade pip |
| 69 | pip install -r requirements.txt |
| 70 | - name: Generate PDF document |
| 71 | run: make latexpdf |
| 72 | env: |
| 73 | SPHINXOPTS: --color |
| 74 | - name: Publish PDF document |
| 75 | uses: actions/upload-artifact@v3 |
| 76 | with: |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 77 | name: ndn-packet-spec-pdf |
Davide Pesavento | 16c9fd2 | 2023-01-17 22:08:10 -0500 | [diff] [blame] | 78 | path: _build/latex/ndn-packet-spec.pdf |
| 79 | if-no-files-found: error |
Davide Pesavento | c0bab4e | 2023-02-03 18:20:25 -0500 | [diff] [blame^] | 80 | |
| 81 | deploy: |
| 82 | if: github.ref_name == 'master' && !inputs.skip-deploy |
| 83 | needs: html |
| 84 | uses: named-data/actions/.github/workflows/docs-deployment.yml@v1 |
| 85 | with: |
| 86 | artifact-name: ndn-packet-spec-html |
| 87 | version: ${{ needs.html.outputs.version }} |
| 88 | secrets: inherit |