|
| 1 | +#/ |
| 2 | +# @license MIT |
| 3 | +# |
| 4 | +# Copyright (c) 2022 Python Data APIs Consortium. |
| 5 | +# |
| 6 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +# of this software and associated documentation files (the "Software"), to deal |
| 8 | +# in the Software without restriction, including without limitation the rights |
| 9 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +# copies of the Software, and to permit persons to whom the Software is |
| 11 | +# furnished to do so, subject to the following conditions: |
| 12 | +# |
| 13 | +# The above copyright notice and this permission notice shall be included in all |
| 14 | +# copies or substantial portions of the Software. |
| 15 | +# |
| 16 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | +# SOFTWARE. |
| 23 | +#/ |
| 24 | + |
| 25 | +# Workflow name: |
| 26 | +name: gh_pages |
| 27 | + |
| 28 | +# Workflow triggers: |
1 | 29 | on:
|
2 | 30 | push:
|
3 | 31 | branches:
|
4 | 32 | - main
|
| 33 | + |
5 | 34 | pull_request:
|
6 | 35 | branches:
|
7 |
| - - "**" |
| 36 | + - "**" |
| 37 | + |
| 38 | +# Workflow jobs: |
8 | 39 | jobs:
|
9 |
| - run: |
10 |
| - # Don't run Action on forks, and allow skipping CI |
| 40 | + |
| 41 | + # Define a job for publishing to the gh-pages branch... |
| 42 | + publish: |
| 43 | + |
| 44 | + # Define a display name: |
| 45 | + name: 'Publish' |
| 46 | + |
| 47 | + # Define the type of virtual host machine: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + |
| 50 | + # Avoid running this workflow for forks and allow skipping CI: |
11 | 51 | if: "github.repository == 'data-apis/array-api' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
|
12 |
| - runs-on: ubuntu-18.04 |
| 52 | + |
| 53 | + # Define a sequence of job steps... |
13 | 54 | steps:
|
14 |
| - # - uses: docker://pandoc/latex:2.9 |
15 |
| - - uses: actions/checkout@master |
16 |
| - - uses: actions/setup-python@v2 |
17 |
| - with: |
18 |
| - python-version: '3.10.2' # Version range or exact version of a Python version to use, using semvers version range syntax. |
19 |
| - architecture: 'x64' # (x64 or x86) |
20 |
| - - run: | |
21 |
| - # add dependencies based on the conf.py |
22 |
| - pip install -r requirements.txt |
23 |
| - - name: Build docs |
24 |
| - run: | |
25 |
| - # Turn warnings into errors; ensure .doctrees doesn't get deployed |
26 |
| - sphinx-build -b html -WT --keep-going spec build/latest -d doctrees |
27 |
| - touch build/.nojekyll |
28 |
| - - uses: actions/upload-artifact@v2 |
29 |
| - if: ${{ github.event_name == 'pull_request'}} |
30 |
| - with: |
31 |
| - name: html |
32 |
| - path: build/ |
33 |
| - if-no-files-found: error |
34 |
| - - name: Deploy |
35 |
| - if: ${{ github.ref == 'refs/heads/main'}} |
36 |
| - uses: peaceiris/actions-gh-pages@v3 |
37 |
| - with: |
38 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
39 |
| - publish_dir: ./build |
| 55 | + |
| 56 | + # Checkout the repository: |
| 57 | + - name: 'Checkout repository' |
| 58 | + uses: actions/checkout@v2 |
| 59 | + with: |
| 60 | + # Specify whether to remove untracked files before checking out the repository: |
| 61 | + clean: false |
| 62 | + |
| 63 | + # Limit clone depth to the most recent commit: |
| 64 | + fetch-depth: 1 |
| 65 | + |
| 66 | + # Specify whether to download Git-LFS files: |
| 67 | + lfs: false |
| 68 | + timeout-minutes: 10 |
| 69 | + |
| 70 | + # Install Python: |
| 71 | + - name: 'Install Python' |
| 72 | + uses: actions/setup-python@v2 |
| 73 | + with: |
| 74 | + python-version: '3.10.2' |
| 75 | + architecture: 'x64' |
| 76 | + |
| 77 | + # Install dependencies: |
| 78 | + - name: 'Install dependencies' |
| 79 | + run: | |
| 80 | + pip install -r ./requirements.txt |
| 81 | +
|
| 82 | + # Generate the documentation: |
| 83 | + - name: 'Build documentation' |
| 84 | + run: | |
| 85 | + # Turn warnings into errors; ensure .doctrees doesn't get deployed |
| 86 | + sphinx-build -b html -WT --keep-going spec build/latest -d doctrees |
| 87 | + touch build/.nojekyll |
| 88 | +
|
| 89 | + # Upload the build artifact: |
| 90 | + - name: 'Upload build artifact' |
| 91 | + uses: actions/upload-artifact@v2 |
| 92 | + if: ${{ github.event_name == 'pull_request'}} |
| 93 | + with: |
| 94 | + name: html |
| 95 | + path: build/ |
| 96 | + if-no-files-found: error |
| 97 | + |
| 98 | + # Deploy the build artifact to gh-pages: |
| 99 | + - name: 'Deploy' |
| 100 | + uses: peaceiris/actions-gh-pages@v3 |
| 101 | + if: ${{ github.ref == 'refs/heads/main'}} |
| 102 | + with: |
| 103 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 104 | + publish_dir: ./build |
0 commit comments