Skip to content

Commit 51f928c

Browse files
authored
Migrate to Hugo (#23)
Rather than trying to continue running something home-grown, let's switch to a proper static site generator. This partially addresses some concerns I [raised after integrating the wiki pages](#21 (comment)) and the problems we ran into when [the workflow to update the HTML pages failed in a PR by a contributor](#22 (comment)): While it still does not offer convenient before/after views, it at least allows to preview the changes in a fork, just like this here PR can be previewed at https://dscho.github.io/gitgitgadget.github.io/ So why even bother with a powerful site generator like Hugo for something as small as GitGitGadget's home page? Well, here are a couple of reasons: - As you can see https://dscho.github.io/gitgitgadget.github.io/architecture, it re-adds the syntax highlighting in code blocks that were lost in the transition away from the wiki. - It will make auto-generating a navigation bar (or a central index page) much easier. - It will make it easier to maintain a unified look-and-feel, e.g. when adding something like an "Edit on GitHub" button. - It should make it somewhat easier to make the site [responsive](#19) because of a much more standard way to build the site. - The migration of the wiki pages was meant as a blueprint I could follow in Git for Windows, where I want to stop wasting my time battling spam and vandalism, and any subsequent work over here that can help with that can increase the synergy between both projects.
2 parents 895f851 + 40f513a commit 51f928c

22 files changed

+298
-1603
lines changed

.github/workflows/deploy.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy to Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: configure Hugo
27+
run: |
28+
set -x &&
29+
echo "HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml)" >>$GITHUB_ENV
30+
- name: install Hugo ${{ env.HUGO_VERSION }}
31+
run: |
32+
set -x &&
33+
deb=hugo_extended_${HUGO_VERSION}_linux-amd64.deb &&
34+
curl -LO https://github.com/gohugoio/hugo/releases/download/v$HUGO_VERSION/$deb &&
35+
sudo dpkg -i $deb
36+
- uses: actions/configure-pages@v5
37+
id: pages
38+
- name: run Hugo to build the pages
39+
env:
40+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
41+
HUGO_ENVIRONMENT: production
42+
HUGO_RELATIVEURLS: false
43+
run: hugo config && hugo --minify --baseURL '${{ steps.pages.outputs.base_url }}/'
44+
- uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: ./public
47+
- uses: actions/deploy-pages@v4
48+
id: deployment

.github/workflows/pr.yml

+22-45
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,26 @@
1-
name: Convert Markdown to HTML
2-
on: pull_request
1+
name: Hugo
2+
on: [pull_request]
33

44
jobs:
5-
md2html: # make sure build/ci work properly
5+
build:
66
runs-on: ubuntu-latest
7-
permissions:
8-
contents: write
9-
issues: write
107
steps:
11-
- uses: actions/checkout@v4
12-
with:
13-
repository: ${{ github.event.pull_request.head.repo.full_name }}
14-
ref: ${{ github.event.pull_request.head.ref }}
15-
- run: npm ci
16-
- run: npm run grunt
17-
- name: check if commit & push is needed
18-
id: check
19-
run: |
20-
git add -A \*.html &&
21-
git diff-index --cached --exit-code HEAD -- ||
22-
echo "need-to-commit=yes" >>$GITHUB_OUTPUT
23-
- name: commit
24-
if: steps.check.outputs.need-to-commit == 'yes'
25-
run: |
26-
git config user.name "${{github.actor}}" &&
27-
git config user.email "${{github.actor}}@users.noreply.github.com" &&
28-
git commit -m 'Convert Markdown to HTML' -- \*.html &&
29-
git update-index --refresh &&
30-
git diff-files --exit-code &&
31-
git diff-index --cached --exit-code HEAD -- &&
32-
git bundle create git.bundle ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.head.ref }}
33-
- name: commit
34-
if: steps.check.outputs.need-to-commit == 'yes' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
35-
run: git push
36-
- name: publish bundle
37-
id: bundle
38-
if: steps.check.outputs.need-to-commit == 'yes' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
39-
uses: actions/upload-artifact@v4
40-
with:
41-
name: bundle
42-
path: git.bundle
43-
- name: instructions how to fetch bundle
44-
if: steps.check.outputs.need-to-commit == 'yes' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
45-
run: |
46-
body='The HTML pages are out of date. Please download the `bundle` artifact from ${{ steps.bundle.outputs.artifact-url }}, extract the `git.bundle` file from it, then run `git pull /path/to/git.bundle ${{ github.event.pull_request.head.ref }}` and then push to the PR branch'
47-
echo "::error::$body" >&2
48-
echo "$body" >>$GITHUB_STEP_SUMMARY
49-
exit 1
8+
- uses: actions/checkout@v4
9+
- name: configure Hugo
10+
run: |
11+
set -x &&
12+
echo "HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml)" >>$GITHUB_ENV
13+
- name: install Hugo ${{ env.HUGO_VERSION }}
14+
run: |
15+
set -x &&
16+
curl -Lo /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v$HUGO_VERSION/hugo_extended_${HUGO_VERSION}_linux-amd64.deb &&
17+
sudo dpkg -i /tmp/hugo.deb
18+
- name: run Hugo to build the pages
19+
run: hugo
20+
- name: build tar archive
21+
run: cd public && tar czvf ../pages.tar.gz *
22+
- name: Upload build artifact
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: pages
26+
path: pages.tar.gz

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/node_modules/
1+
/.hugo_build.lock
2+
/public/
3+
/resources/_gen/

Gruntfile.js

-26
This file was deleted.

architecture.html

-151
This file was deleted.

assets/sass/main.scss

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
body {
2+
font-family: sans-serif;
3+
background-color: #d7cdc0ff;
4+
background-image: linear-gradient(#d7cdc0ff, #fdf7f6ff);
5+
margin-right: 10%;
6+
margin-left: 10%;
7+
}
8+
.block {
9+
background-color: rgb(247, 243, 239);
10+
color: #000000;
11+
padding: 1em;
12+
padding-top: .1em;
13+
padding-bottom: .1em;
14+
border-radius: 2em;
15+
}
16+
.banner {
17+
text-align: center;
18+
font-weight: bold;
19+
td img {
20+
height: 150px;
21+
}
22+
}
23+
big {
24+
font-size: 400%;
25+
}
26+
small {
27+
font-size: 70%;
28+
}
29+
div.feature-matrix {
30+
table {
31+
border-collapse: collapse;
32+
border-spacing: 0;
33+
margin: 0px auto;
34+
}
35+
td {
36+
padding: 10px 5px;
37+
border-style: solid;
38+
border-width: 1px;
39+
overflow: hidden;
40+
word-break: normal;
41+
border-color: black;
42+
}
43+
th {
44+
font-weight: bold;
45+
padding: 10px 5px;
46+
border-style: solid;
47+
border-width: 1px;
48+
overflow: hidden;
49+
word-break: normal;
50+
border-color: black;
51+
}
52+
th,td {
53+
width: 15%;
54+
text-align: center;
55+
vertical-align: center;
56+
}
57+
th:first-child,td:first-child {
58+
width: 70%;
59+
text-align: left;
60+
vertical-align: center;
61+
}
62+
}
63+
@media screen and (max-width: 767px) {
64+
.tg {
65+
width: auto !important;
66+
}
67+
.tg col {
68+
width: auto !important;
69+
}
70+
.tg-wrap {
71+
overflow-x: auto;
72+
-webkit-overflow-scrolling: touch;
73+
margin: auto 0px;
74+
}
75+
}

0 commit comments

Comments
 (0)