Skip to content

Commit 8144736

Browse files
feat(build): use jekyll and restyle website
1 parent bd71bb4 commit 8144736

Some content is hidden

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

76 files changed

+1947
-1589
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ignore hidden files
2+
.*
3+
4+
!.well-known/
5+
6+
third-party/beautiful-jekyll/_posts/
7+
8+
_site/

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ensure dockerfiles are checked out with LF line endings
2+
Dockerfile text eol=lf
3+
*.dockerfile text eol=lf

.github/workflows/build.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Jekyll CI
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- master
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
push:
13+
branches:
14+
- master
15+
16+
concurrency:
17+
group: "${{ github.workflow }}-${{ github.ref }}"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
call-jekyll-build:
22+
uses: ./.github/workflows/jekyll-build.yml
23+
with:
24+
target_branch: gh-pages
25+
clean_gh_pages: true
26+
secrets:
27+
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
28+
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
29+
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
30+
31+
release:
32+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Setup Release
36+
id: setup-release
37+
uses: LizardByte/[email protected]
38+
with:
39+
github_token: ${{ secrets.GH_BOT_TOKEN }}
40+
41+
- name: Create Release
42+
id: action
43+
uses: LizardByte/[email protected]
44+
with:
45+
allowUpdates: false
46+
artifacts: ''
47+
body: ${{ steps.setup-release.outputs.release_body }}
48+
generateReleaseNotes: ${{ steps.setup-release.outputs.release_generate_release_notes }}
49+
name: ${{ steps.setup-release.outputs.release_tag }}
50+
prerelease: true
51+
tag: ${{ steps.setup-release.outputs.release_tag }}
52+
token: ${{ secrets.GH_BOT_TOKEN }}

.github/workflows/jekyll-build.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
---
2+
name: Build Jekyll
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
site_artifact:
8+
description: 'Artifact name to download'
9+
required: false
10+
default: ''
11+
type: string
12+
config_file:
13+
description: 'Configuration file to use, relative to the site source directory'
14+
required: false
15+
default: '_config.yml'
16+
type: string
17+
target_branch:
18+
description: 'Branch to deploy to. Branch must already exist.'
19+
required: false
20+
default: 'gh-pages'
21+
type: string
22+
clean_gh_pages:
23+
description: 'Clean gh-pages before deploying'
24+
required: false
25+
default: true
26+
type: boolean
27+
theme_ref:
28+
description: 'Branch, tag, or commit SHA of the theme repository to use'
29+
required: false
30+
default: 'master'
31+
type: string
32+
secrets:
33+
GH_BOT_EMAIL:
34+
description: 'Email address of the bot account'
35+
required: true
36+
GH_BOT_NAME:
37+
description: 'Name of the bot account'
38+
required: true
39+
GH_BOT_TOKEN:
40+
description: 'Personal access token of the bot account'
41+
required: true
42+
43+
jobs:
44+
build:
45+
name: Build Jekyll
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Input validation
49+
run: |
50+
error=false
51+
if [ "${{ inputs.site_artifact }}" == 'site' ]; then
52+
echo "Artifact name cannot be 'site'"
53+
error=true
54+
fi
55+
56+
if [ "$error" = true ]; then
57+
exit 1
58+
fi
59+
60+
- name: Checkout theme
61+
uses: actions/checkout@v4
62+
with:
63+
repository: LizardByte/LizardByte.github.io
64+
ref: ${{ github.repository == 'LizardByte/LizardByte.github.io' && github.ref || inputs.theme_ref }}
65+
submodules: recursive
66+
path: theme
67+
68+
- name: Checkout project
69+
if: ${{ inputs.site_artifact != '' }}
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: ${{ inputs.site_artifact }}
73+
path: project
74+
75+
- name: Setup project
76+
if: ${{ github.repository == 'LizardByte/LizardByte.github.io' }}
77+
run: |
78+
mkdir -p ./project
79+
cp -RT ./theme/ ./project/
80+
rm -rf ./project/third-party
81+
82+
- name: Create site
83+
env:
84+
TMPDIR: /home/runner/work/tmp
85+
run: |
86+
mkdir -p ${TMPDIR}
87+
88+
base_dirs=(
89+
./theme/third-party/beautiful-jekyll
90+
./theme
91+
)
92+
93+
targets=(
94+
*.gemspec
95+
_data
96+
_includes
97+
_layouts
98+
_sass
99+
assets
100+
404.html
101+
_config_theme.yml
102+
favicon.ico
103+
feed.xml
104+
Gemfile
105+
staticman.yml
106+
tags.html
107+
)
108+
109+
for base_dir in "${base_dirs[@]}"; do
110+
for target in "${targets[@]}"; do
111+
if [ -e "$base_dir/$target" ]; then
112+
cp -rf "$base_dir/$target" ${TMPDIR}/
113+
fi
114+
done
115+
done
116+
117+
# copy project directory, they should only come from the project repo
118+
cp -RTf ./project/ ${TMPDIR}/
119+
120+
# remove the workspace
121+
cd ..
122+
rm -rf ${GITHUB_WORKSPACE}
123+
124+
# move the temporary directory to the workspace
125+
mv ${TMPDIR} ${GITHUB_WORKSPACE}
126+
cd ${GITHUB_WORKSPACE}
127+
128+
# debug contents recursively
129+
ls -Ra
130+
131+
- name: Setup Ruby
132+
uses: ruby/setup-ruby@v1
133+
with:
134+
ruby-version: '3.3'
135+
136+
- name: Install dependencies
137+
run: |
138+
bundle install
139+
140+
- name: Setup Pages
141+
id: configure-pages
142+
uses: actions/configure-pages@v5
143+
144+
- name: Setup CI config
145+
run: |
146+
echo "---" > _config_ci.yml
147+
echo "baseurl: ${{ steps.configure-pages.outputs.base_path }}" >> _config_ci.yml
148+
149+
- name: Build site
150+
env:
151+
JEKYLL_ENV: production
152+
PAGES_REPO_NWO: ${{ github.repository }}
153+
run: |
154+
# if inputs.config_file exists
155+
config_files="_config_ci.yml,_config_theme.yml"
156+
if [ -e "${{ inputs.config_file }}" ]; then
157+
config_files="${config_files},${{ inputs.config_file }}"
158+
fi
159+
160+
bundle exec jekyll build --future --config ${config_files}
161+
162+
- name: Upload artifact
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: site
166+
path: _site
167+
if-no-files-found: error
168+
include-hidden-files: true
169+
retention-days: 1
170+
171+
deploy:
172+
name: Deploy to Pages
173+
if: >-
174+
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
175+
(github.event_name == 'workflow_dispatch')
176+
runs-on: ubuntu-latest
177+
needs: build
178+
steps:
179+
- name: Checkout gh-pages
180+
uses: actions/checkout@v4
181+
with:
182+
ref: ${{ inputs.target_branch }}
183+
path: gh-pages
184+
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
185+
fetch-depth: 0 # otherwise, will fail to push refs to dest repo
186+
187+
- name: Clean
188+
if: ${{ inputs.clean_gh_pages }}
189+
run: |
190+
# empty contents of gh-pages
191+
rm -f -r ./gh-pages/*
192+
193+
- name: Download artifact
194+
uses: actions/download-artifact@v4
195+
with:
196+
name: site
197+
path: gh-pages
198+
199+
- name: no-jekyll
200+
run: |
201+
touch gh-pages/.nojekyll
202+
203+
- name: Deploy to gh-pages
204+
uses: actions-js/[email protected]
205+
with:
206+
github_token: ${{ secrets.GH_BOT_TOKEN }}
207+
author_email: ${{ secrets.GH_BOT_EMAIL }}
208+
author_name: ${{ secrets.GH_BOT_NAME }}
209+
directory: gh-pages
210+
branch: ${{ inputs.target_branch }}
211+
force: false
212+
message: "Deploy site from ${{ github.sha }}"

.github/workflows/rss-monitor.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Monitor RSS feed
3+
4+
on:
5+
schedule:
6+
- cron: "0 * * * *" # hourly
7+
8+
jobs:
9+
rss-monitor:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: RSS to issues
13+
uses: git-for-windows/rss-to-issues@v0
14+
with:
15+
github-token: ${{ secrets.GH_BOT_TOKEN }}
16+
feed: https://lizardbyte.github.io/feed.xml
17+
character-limit: 0
18+
dry-run: false
19+
max-age: 48h
20+
labels: blog

0 commit comments

Comments
 (0)