Skip to content

Commit 09cdac2

Browse files
committed
infra: Change rendering engine from Docusaurus to Jekyll
- Remove `chapters/` hierarchy, `config.yaml` and `gen-view.py`. - Re-split lab content into individual labs under `labs/lab-<number>/`. - Add `_config.yaml` Gemfile for Jekyll. - Update `Makefile` and `Dockerfile` to build the container and serve the website with Jekyll. - Update the information in the global `README.md`. - Replace topic/chapter labels with lab-based ones. - Update PR rendering for Jekyll. Signed-off-by: Alex Apostolescu <[email protected]>
1 parent 5db2ced commit 09cdac2

File tree

2,479 files changed

+22691
-43629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,479 files changed

+22691
-43629
lines changed

.github/workflows/deployment.yml

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,26 @@ jobs:
1010
name: Deploy to GitHub Pages
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
with:
15-
path: ./repo
13+
- uses: actions/checkout@v3
1614

17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v1
15+
- name: Build Jekyll site
16+
run: |
17+
# GitHub-specific config
18+
echo "url: https://${{ github.repository_owner }}.github.io" >> _config.yaml
19+
echo "baseurl: /operating-systems" >> _config.yaml
1920
20-
- name: Build and push
21-
uses: docker/build-push-action@v2
22-
with:
23-
context: ./repo
24-
file: ./repo/Dockerfile
25-
push: false
26-
load: true
27-
tags: operating-systems-oer/docusaurus:latest
28-
cache-from: type=gha
29-
cache-to: type=gha
21+
# Build Docker image for Jekyll
22+
docker build -t jekyll-image .
3023
31-
- name: Load image
32-
run: |
33-
mkdir output
34-
docker image list
35-
docker run -v $GITHUB_WORKSPACE/repo:/content -v $GITHUB_WORKSPACE/output:/output operating-systems-oer/docusaurus:latest
24+
# Build Jekyll site
25+
docker run --rm \
26+
-v ${{ github.workspace }}:/usr/src/app \
27+
jekyll-image bundle exec jekyll build
3628
37-
# Popular action to deploy to GitHub Pages:
38-
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
3929
- name: Deploy to GitHub Pages
4030
uses: peaceiris/actions-gh-pages@v3
4131
with:
42-
personal_token: ${{ secrets.ACCESS_TOKEN }}
43-
# Build output to publish to the `gh-pages` branch:
44-
publish_dir: ./output
45-
# The following lines assign commit authorship to the official
46-
# GH-Actions bot for deploys to `gh-pages` branch:
47-
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
48-
# The GH actions bot is used by default if you didn't specify the two fields.
49-
# You can swap them out with your own user credentials.
50-
user_name: 'github-actions[bot]'
51-
user_email: 'github-actions[bot]@users.noreply.github.com'
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: _site
5234
publish_branch: gh-pages
35+
enable_jekyll: true

.github/workflows/os-runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
contents: read
1818

1919
steps:
20-
- name: Checkout
20+
- name: Checkout
2121
uses: actions/checkout@v3
2222

2323
- name: Set up QEMU
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,65 @@
11
name: OpenEduHub - PR Deployment
22

33
on:
4+
workflow_dispatch:
45
pull_request_target:
56
types: [labeled]
67

78
jobs:
89
deploy:
9-
if: ${{ github.event.label.name == 'needs-rendering' }}
10+
if: ${{ github.event.label.name == 'needs-rendering' || github.event_name == 'workflow_dispatch' }}
1011
name: Deploy to GitHub Pages
1112
runs-on: ubuntu-latest
1213
permissions:
1314
contents: write
1415
pull-requests: write
1516
steps:
17+
- name: Set Deployment ID
18+
run: |
19+
# Use PR number for PR trigger and commit SHA for manual trigger
20+
if [[ -z "${{ github.event.pull_request.number }}" ]]; then
21+
echo "DEPLOYMENT_ID=trigger-${GITHUB_SHA::7}" >> $GITHUB_ENV
22+
else
23+
echo "DEPLOYMENT_ID=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
24+
fi
25+
echo "DEPLOYMENT_ID=${{ env.DEPLOYMENT_ID }}"
26+
1627
- uses: actions/checkout@v3
1728
with:
18-
path: ./repo
1929
repository: ${{ github.event.pull_request.head.repo.full_name }}
2030
ref: ${{ github.head_ref }}
2131

22-
- run: |
23-
cd repo
24-
REF=$(echo ${{ github.event.number }} | sed 's/\//\\\//g')
25-
sed -i "s/baseUrl: \/operating-systems\//baseUrl: \/operating-systems\/$REF\//" config.yaml
26-
27-
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v1
32+
- name: Build Jekyll site
33+
run: |
34+
# GitHub-specific config
35+
echo "url: https://${{ github.repository_owner }}.github.io" >> _config.yaml
36+
echo "baseurl: /operating-systems/${{ env.DEPLOYMENT_ID }}" >> _config.yaml
2937
30-
- name: Build and push
31-
uses: docker/build-push-action@v3
32-
with:
33-
context: ./repo
34-
file: ./repo/Dockerfile
35-
push: false
36-
load: true
37-
tags: operating-systems/docusaurus:latest
38-
cache-from: type=gha
39-
cache-to: type=gha
38+
# Build Docker image for Jekyll
39+
docker build -t jekyll-site .
4040
41-
- name: Load Image
42-
run: |
43-
mkdir -p ${{ github.event.number }}
44-
docker image list
45-
docker run -v $GITHUB_WORKSPACE/repo:/content -v $GITHUB_WORKSPACE/${{ github.event.number }}:/output operating-systems/docusaurus:latest
41+
# Build Jekyll site
42+
docker run --rm \
43+
-v ${{ github.workspace }}:/usr/src/app/ \
44+
jekyll-site bundle exec jekyll build
4645
47-
# Popular action to deploy to GitHub Pages:
48-
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
4946
- name: Deploy to GitHub Pages
5047
uses: peaceiris/actions-gh-pages@v3
5148
with:
5249
github_token: ${{ secrets.GITHUB_TOKEN }}
53-
# Build output to publish to the `gh-pages-pr` branch:
54-
publish_dir: ./${{ github.event.number }}
55-
destination_dir: ${{ github.event.number }}
56-
# The following lines assign commit authorship to the official
57-
# GH-Actions bot for deploys to `gh-pages` branch:
58-
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
59-
# The GH actions bot is used by default if you didn't specify the two fields.
60-
# You can swap them out with your own user credentials.
50+
publish_dir: _site
51+
destination_dir: ${{ env.DEPLOYMENT_ID }}
6152
publish_branch: gh-pages
53+
enable_jekyll: true
6254

6355
- name: Add Comment to PR
56+
if: ${{ !startsWith(env.DEPLOYMENT_ID, 'trigger-') }}
6457
uses: thollander/actions-comment-pull-request@v2
6558
with:
6659
message: |
67-
Published at https://${{ github.repository_owner }}.github.io/operating-systems/${{ github.event.number }}/
60+
Published at https://${{ github.repository_owner }}.github.io/operating-systems/${{ env.DEPLOYMENT_ID }}/
61+
62+
- name: Output Deployment URL
63+
if: ${{ startsWith(env.DEPLOYMENT_ID, 'trigger-') }}
64+
run: |
65+
echo "The deployment is available at https://${{ github.repository_owner }}.github.io/operating-systems/${{ env.DEPLOYMENT_ID }}/"

.gitignore

Lines changed: 12 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -76,109 +76,15 @@ dkms.conf
7676
# reveal-md slides output folder
7777
_site/
7878

79-
# Temporary files
80-
*.swp
81-
*.swo
82-
*~
83-
slides.md
84-
85-
# .gif files generated with ffmpeg
86-
*-generated.gif
87-
88-
# JavaScript files
89-
90-
# compiled output
91-
/dist
92-
/tmp
93-
/out-tsc
94-
95-
# Runtime data
96-
pids
97-
*.pid
98-
*.seed
99-
*.pid.lock
100-
101-
# Directory for instrumented libs generated by jscoverage/JSCover
102-
lib-cov
103-
104-
# Coverage directory used by tools like istanbul
105-
coverage
106-
107-
# nyc test coverage
108-
.nyc_output
109-
110-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
111-
.grunt
112-
113-
# Bower dependency directory (https://bower.io/)
114-
bower_components
115-
116-
# node-waf configuration
117-
.lock-wscript
118-
119-
# IDEs and editors
120-
.idea
121-
.project
122-
.classpath
123-
.c9/
124-
*.launch
125-
.settings/
126-
*.sublime-workspace
127-
128-
# IDE - VSCode
129-
.vscode/*
130-
!.vscode/settings.json
131-
!.vscode/tasks.json
132-
!.vscode/launch.json
133-
!.vscode/extensions.json
134-
135-
# misc
136-
.sass-cache
137-
connect.lock
138-
typings
139-
140-
# Logs
141-
logs
142-
*.log
143-
npm-debug.log*
144-
yarn-debug.log*
145-
yarn-error.log*
146-
147-
# Dependency directories
148-
node_modules/
149-
jspm_packages/
150-
151-
# Optional npm cache directory
152-
.npm
153-
154-
# Optional eslint cache
155-
.eslintcache
156-
157-
# Optional REPL history
158-
.node_repl_history
159-
160-
# Output of 'npm pack'
161-
*.tgz
162-
163-
# Yarn Integrity file
164-
.yarn-integrity
165-
166-
# dotenv environment variables file
167-
.env
168-
169-
# next.js build output
170-
.next
171-
172-
# Lerna
173-
lerna-debug.log
174-
175-
# System Files
176-
.DS_Store
177-
Thumbs.db
178-
179-
# Docusaurus build files
180-
.output/
181-
.view/
182-
183-
# VSCode
184-
.vscode/
79+
# Builder output folder
80+
/.output/
81+
82+
# Ruby files for the local Jekyll server
83+
.sass-cache/
84+
.jekyll-cache/
85+
.jekyll-metadata
86+
87+
# Ignore folders generated by Bundler
88+
.bundle/
89+
vendor/
90+
*.lock

Dockerfile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
FROM ghcr.io/open-education-hub/openedu-builder:0.6.1
1+
FROM ruby:3.0-slim
22

3-
# Install ffmpeg
4-
RUN apt-get update && \
5-
apt-get install -y ffmpeg curl make
3+
RUN apt-get update && apt-get install -y \
4+
build-essential \
5+
zlib1g-dev \
6+
&& rm -rf /var/lib/apt/lists/*
67

7-
# Install markdown-pp
8-
RUN pip install MarkdownPP
8+
WORKDIR /usr/src/app
99

10-
# Install node LTS (16)
11-
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
12-
apt-get install -y nodejs
10+
COPY Gemfile ./
11+
RUN gem install bundler:2.5.23 && bundle install
1312

14-
# Install reveal md
15-
RUN npm install -g reveal-md
13+
EXPOSE 4000
1614

17-
# Install docusaurus
18-
RUN npm install [email protected]
19-
20-
WORKDIR /content
21-
22-
ENTRYPOINT ["oe_builder"]
15+
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0"]

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gem 'jekyll-titles-from-headings'
6+
gem 'jekyll-seo-tag'
7+
gem 'jekyll-remote-theme'
8+
gem 'github-pages', group: :jekyll_plugins

Makefile

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,20 @@
1-
REPO_NAME = operating-systems
2-
IMAGE_NAME = $(REPO_NAME)/docusaurus:latest
3-
CONTAINER_NAME = open-edu-hub-$(REPO_NAME)-bash
4-
OUTPUT_DIR = $$PWD/.output/$(REPO_NAME)
1+
IMG_NAME=$(shell basename $(CURDIR))
2+
CONT_NAME=$(IMG_NAME)
53

6-
.PHONY: all buildimg build serve run_bash enter_bash stop_bash clean cleanall
7-
8-
all: build
9-
10-
buildimg:
11-
docker build -f ./Dockerfile --tag $(IMAGE_NAME) .
12-
13-
build: buildimg
14-
@echo "Building content. This will take a while (several minutes) ..."
15-
@echo "After the build, run"
16-
@echo ""
17-
@echo " make serve"
18-
@echo ""
19-
@mkdir -p $(OUTPUT_DIR)
20-
docker run --rm -v $$PWD/:/content -v $(OUTPUT_DIR):/output $(IMAGE_NAME)
4+
build:
5+
docker build -t $(IMG_NAME) .
216

227
serve:
23-
@echo "Point your browser to http://localhost:8080/$(REPO_NAME)"
24-
@cd $(OUTPUT_DIR)/.. && python3 -m http.server 8080
25-
26-
run_bash: buildimg
27-
@mkdir -p $(OUTPUT_DIR)
28-
docker run -d -it --entrypoint /bin/bash --name $(CONTAINER_NAME) -v $$PWD/:/content -v $(OUTPUT_DIR):/output $(IMAGE_NAME)
29-
30-
enter_bash:
31-
docker exec -it $(CONTAINER_NAME) /bin/bash
32-
33-
stop_bash:
34-
-test "$(shell docker container inspect -f '{{.State.Running}}' $(CONTAINER_NAME) 2> /dev/null)" = "true" && docker stop $(CONTAINER_NAME)
8+
docker run --rm -p 4000:4000 -v $$PWD:/usr/src/app $(IMG_NAME)
359

36-
clean: stop_bash
37-
-docker container inspect $(CONTAINER_NAME) > /dev/null 2>&1 && docker rm $(CONTAINER_NAME)
38-
-sudo rm -fr $(OUTPUT_DIR)
10+
stop:
11+
@docker ps -q --filter "name=$(CONT_NAME)" | grep -q . && docker stop $(CONT_NAME) \
12+
|| echo "No running container to stop."
3913

40-
cleanall: clean
41-
-docker inspect --type=image $(IMAGE_NAME) > /dev/null 2>&1 && docker image rm $(IMAGE_NAME)
14+
clean: stop
15+
docker rmi $(IMG_NAME)
16+
rm -rf _site
4217

43-
# Linters
4418
.PHONY: lint typos
4519
lint: typos
4620

0 commit comments

Comments
 (0)