Skip to content

Commit 1ef7417

Browse files
committed
Add GitHub Actions workflow to build and deploy Pelican site
1 parent b4242fe commit 1ef7417

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/pelican.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Deploy to GitHub Pages
2+
3+
# This workflow is adapted from:
4+
# https://github.com/getpelican/pelican/blob/master/.github/workflows/github_pages.yml
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Checkout custom theme
30+
run: git clone https://github.com/pemo-ml/mywilson.git .theme
31+
32+
- name: Install dependencies
33+
run: pip install -r requirements.txt
34+
35+
- name: Build site with Pelican
36+
run: |
37+
pelican content --settings publishconf.py --theme .theme
38+
39+
- name: Run custom redirect script
40+
run: python replace_index_with_redirect.py
41+
42+
- name: Fix permissions
43+
run: |
44+
chmod -c -R +rX output | while read line; do
45+
echo "::warning title=Invalid file permissions automatically fixed::$line"
46+
done
47+
48+
- name: Upload site artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: output
52+
53+
deploy:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
concurrency:
60+
group: "pages"
61+
cancel-in-progress: false
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)