-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (78 loc) · 2.69 KB
/
github_pages.yml
File metadata and controls
81 lines (78 loc) · 2.69 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Deploy to GitHub Pages
on:
workflow_call:
inputs:
settings:
required: true
description: "The path to your Pelican settings file (`pelican`'s `--settings` option), for example: 'publishconf.py'"
default: "PelicanWebsite/pelicanconfig.py"
type: string
requirements:
required: false
default: "pelican[markdown]"
description: "The Python requirements to install, for example to enable markdown and typogrify use: 'pelican[markdown] typogrify' or if you have a requirements file use: '-r requirements.txt'"
type: string
output-path:
required: false
default: "output/"
description: "Where to output the generated files (`pelican`'s `--output` option)"
type: string
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download notebooks workflow artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: notebook_run.yml
name: notebook-outputs
path: notebook-outputs/
if_no_artifact_found: fail
- name: Move plots to site directory
# moves all files with .png to static website directory for images
run: |
find notebook-outputs/ -name "*.png" -exec mv {} PelicanWebsite/content/img/ \;
find notebook-outputs/ -name "*.html" -exec mv {} PelicanWebsite/content/notebooks_html/ \;
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Configure GitHub Pages
id: pages
uses: actions/configure-pages@v3
- name: Install requirements
run: pip install ${{ inputs.requirements }}
- name: Build Pelican site
run: |
pelican \
--settings "${{ inputs.settings }}" \
--extra-settings SITEURL='"${{ steps.pages.outputs.base_url }}"' \
--output "${{ inputs.output-path }}"
- name: Fix permissions
run: |
chmod -c -R +rX "${{ inputs.output-path }}" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ${{ inputs.output-path }}
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2