-
Notifications
You must be signed in to change notification settings - Fork 90
53 lines (53 loc) · 1.81 KB
/
pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
name: site
on:
push:
workflow_dispatch:
permissions:
# allow GITHUB_TOKEN to deploy to GitHub Pages
contents: read
pages: write
id-token: write
concurrency: {group: "${{ github.ref }}-pages", cancel-in-progress: true}
env:
SITE_PREFIX: state-of-open-source-ai
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with: {python-version: '3.x'}
- id: pages
uses: actions/configure-pages@v3
- run: pip install -r requirements.txt
- name: jupyter-book build
run: |
sed -ri 's#^(\s*baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}/'$SITE_PREFIX'#g' _config.yml
# https://jupyterbook.org/en/stable/reference/cli.html
jupyter-book build --builder linkcheck --warningiserror --nitpick --keep-going .
jupyter-book build --builder dirhtml --warningiserror --nitpick --keep-going .
jupyter-book build --builder latex .
- uses: xu-cheng/latex-action@v2
with:
working_directory: _build/latex
root_file: book.tex
args: -pdf -dvi- -ps- -file-line-error -f -interaction=nonstopmode
continue-on-error: true
- name: prepare _site pages
run: |
mkdir _site
mv _build/dirhtml _site/$SITE_PREFIX
mv _build/latex/book.pdf _site/$SITE_PREFIX.pdf
sed "s#DESTINATION#${{ steps.pages.outputs.base_url }}/$SITE_PREFIX#g" .redirect-template.html > _site/index.html
- uses: actions/upload-pages-artifact@v2
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- id: deployment
uses: actions/deploy-pages@v2