File tree 8 files changed +99
-457
lines changed
8 files changed +99
-457
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
9
9
jobs :
10
10
build :
11
+ if : github.ref != 'refs/heads/main'
11
12
runs-on : ubuntu-latest
12
13
13
14
steps :
14
15
- uses : actions/checkout@v4
16
+
17
+ # Make index.html
18
+ - name : Set up Python
19
+ uses : actions/setup-python@v4
20
+ with :
21
+ python-version : 3.11
22
+ - name : Generate index.html
23
+ run : |
24
+ sudo apt update
25
+ sudo apt install -y ruby-bundler ruby-dev
26
+ python3 -m pip install -r requirements.txt
27
+ python3 make_index.py
28
+
29
+ - name : Build the site in the jekyll/builder container
30
+ run : |
31
+ docker run \
32
+ -v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
33
+ jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future"
34
+
35
+ build-and-deploy :
36
+ if : github.ref == 'refs/heads/main'
37
+ runs-on : ubuntu-latest
38
+
39
+ permissions :
40
+ contents : read
41
+ pages : write
42
+ id-token : write
43
+
44
+ steps :
45
+ - uses : actions/checkout@v4
46
+
47
+ # Make index.html
48
+ - name : Set up Python
49
+ uses : actions/setup-python@v4
50
+ with :
51
+ python-version : 3.11
52
+ - name : Generate index.html
53
+ run : |
54
+ sudo apt update
55
+ sudo apt install -y ruby-bundler ruby-dev
56
+ python3 -m pip install -r requirements.txt
57
+ python3 make_index.py
58
+
15
59
- name : Build the site in the jekyll/builder container
16
60
run : |
17
61
docker run \
18
62
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
19
63
jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future"
64
+
65
+ # Deploy to GitHub Pages
66
+ - name : Setup Pages
67
+ uses : actions/configure-pages@v3
68
+ - name : Upload artifact
69
+ uses : actions/upload-pages-artifact@v1
70
+ with :
71
+ path : ' _site'
72
+ - name : Deploy to GitHub Pages
73
+ id : deployment
74
+ uses : actions/deploy-pages@v1
Original file line number Diff line number Diff line change
1
+ index.html
2
+ * .pyc
3
+ _web /
4
+ Gemfile.lock
5
+ _site /
Original file line number Diff line number Diff line change 1
- ---
2
- pagetitle : FEniCSx Project Documentation
3
- header-includes : <link rel="shortcut icon" type="image/x-icon" href="https://fenicsproject.org/favicon.ico"/>
4
- ---
5
-
6
- # FEniCSx Project Documentation
7
-
8
- <img style =" display : block ; margin : 0 auto ; width : 70px ;" src =" https://fenicsproject.org/pub/graphics/fenics_logo.svg " alt =" FEniCS project logo " >
9
-
10
1
## Latest release
11
2
12
3
#### DOLFINx
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from markdown import markdown
4
+
5
+
6
+ def system (command ):
7
+ assert os .system (command ) == 0
8
+
9
+
10
+ _path = os .path .dirname (os .path .realpath (__file__ ))
11
+ web_path = os .path .join (_path , "_web" )
12
+
13
+ if os .path .isdir (web_path ):
14
+ system (f"rm -r { web_path } " )
15
+ system (f"git clone http://github.com/FEniCS/web { web_path } " )
16
+
17
+ with open (os .path .join (web_path , "template.md" ), "w" ) as f :
18
+ f .write ("---\n " )
19
+ f .write ("title: \" FEniCSx Documentation\" \n " )
20
+ f .write ("---\n " )
21
+ f .write ("\n " )
22
+ f .write ("!!CONTENT!!\n " )
23
+
24
+ system (f"cd { web_path } && bundle install && bundle exec jekyll build" )
25
+
26
+ with open (os .path .join (web_path , "_site/template.html" )) as f :
27
+ template = f .read ()
28
+
29
+ template = template .replace ("<p>!!" , "!!" )
30
+ template = template .replace ("!!</p>" , "!!" )
31
+ template = template .replace ("=\" /" , "=\" https://fenicsproject.org/" )
32
+ template = template .replace ("(/assets" , "(https://fenicsproject.org/assets" )
33
+
34
+ with open ("README.md" ) as f :
35
+ readme = f .read ()
36
+
37
+ with open ("index.html" , "w" ) as f :
38
+ f .write (template .replace ("!!CONTENT!!" , markdown (readme )))
You can’t perform that action at this time.
0 commit comments