Compare commits

...

10 commits

Author SHA1 Message Date
Jean-Michel Tremblay
9e216d6344 test
All checks were successful
Build Website / build (push) Successful in 1s
2026-04-23 19:33:34 -04:00
Jean-Michel Tremblay
8aea75ef03 test
Some checks failed
Build Website / build (push) Failing after 1m0s
2026-04-23 19:29:28 -04:00
Jean-Michel Tremblay
b41603c6b3 test
Some checks failed
Build Website / build (push) Has been cancelled
2026-04-23 19:25:16 -04:00
Jean-Michel Tremblay
6a03437153 test
Some checks failed
Build Website / build (push) Failing after 0s
2026-04-23 19:23:52 -04:00
Jean-Michel Tremblay
80cbb6f32a test
Some checks failed
Build Website / build (push) Has been cancelled
2026-04-23 17:14:43 -04:00
Jean-Michel Tremblay
7accb7b1fc test
Some checks failed
Build Website / build (push) Failing after 1s
2026-04-23 17:13:43 -04:00
Jean-Michel Tremblay
f8afee50f3 test
Some checks failed
Build Website / build (push) Failing after 1s
2026-04-23 17:12:38 -04:00
Jean-Michel Tremblay
48a2987ec5 fuck with builds
Some checks failed
Build Website / build (push) Failing after 0s
2026-04-23 17:11:39 -04:00
Jean-Michel Tremblay
c73440f08d run on shell
All checks were successful
Build Website / build (push) Successful in 1s
2026-04-23 17:08:28 -04:00
Jean-Michel Tremblay
d70d897470 adding file to get effing date in git
All checks were successful
Build Website / build (push) Successful in 1s
fix dates / git, resume CI/CD.
2026-04-23 16:46:05 -04:00
10 changed files with 173 additions and 8 deletions

View file

@ -2,7 +2,7 @@ name: Build Website
on: [push]
jobs:
build:
runs-on: docker
runs-on: shell
steps:
- name: Checkout
run: |
@ -12,24 +12,55 @@ jobs:
run: |
mkdir -p site/public
chmod 777 site
# - name: Build
# run: |
# mkdir -p "$PWD/.hugo-cache"
# docker run --rm \
# -u "$(id -u):$(id -g)" \
# -v "$PWD/site:/src" \
# -v "$PWD/.git:/src/.git:ro" \
# -v "$PWD/.hugo-cache:/cache" \
# -e GOPATH=/cache \
# -w /src \
# forgejo.jmopines.com/jm/hugo-git:latest \
# --minify --destination "public" --baseURL "/"
# - name: Deploy
# run: |
# echo "${{ secrets.FORGEJO_SSH }}" > /tmp/deploy_key
# chmod 600 /tmp/deploy_key
# rsync -az --delete \
# --exclude 'resume/' \
# -e "ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no" \
# site/public/. \
# ${{ vars.JMOPINES_USER }}@${{ vars.JMOPINES_IP }}:/var/www/jmopines/
# rm /tmp/deploy_key
- name: Build
run: |
mkdir -p "$PWD/.hugo-cache"
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$PWD/site:/src" \
-v "$PWD/.git:/src/.git:ro" \
-v "$PWD/.hugo-cache:/cache" \
-e GOPATH=/cache \
-w /src \
ghcr.io/gohugoio/hugo:latest \
forgejo.jmopines.com/jm/hugo-git:latest \
--minify --destination "public" --baseURL "/"
- name: Deploy
run: |
set -ex
# Verify files exist
ls -la site/public/
# Setup SSH
echo "${{ secrets.FORGEJO_SSH }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
rsync -az --delete \
# Sync with verbose output so we see what is happening
rsync -avz --delete \
--exclude 'resume/' \
-e "ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no" \
site/public/. \
site/public/ \
${{ vars.JMOPINES_USER }}@${{ vars.JMOPINES_IP }}:/var/www/jmopines/
rm /tmp/deploy_key

8
scripts/Dockerfile Normal file
View file

@ -0,0 +1,8 @@
FROM ghcr.io/gohugoio/hugo:latest
# Install git into the Alpine-based Hugo image so Hugo can query git
# history for `.Lastmod`. We keep the image minimal.
USER root
RUN apk add --no-cache git
USER hugo

View file

@ -14,11 +14,19 @@ fi
echo "[build] Building site into ${SITE_DIR}/public ..."
# Run Hugo in Docker to produce static files. This does not start the dev server.
# Use the prebuilt/pushed Hugo image (hardcoded to the image created by
# scripts/push_hugo_image.sh). This keeps the build script simple and
# predictable.
HUGO_GIT_IMAGE="forgejo.jmopines.com/jm/hugo-git:latest"
USE_IMAGE="${HUGO_GIT_IMAGE}"
# Run Hugo in Docker to produce static files. Mount the content and the repo
# .git directory so Hugo can resolve git-based dates. Mount .git read-only.
docker run --rm \
-v "${SITE_DIR}:/src" \
-v "${PROJECT_ROOT}/.git:/src/.git:ro" \
-w /src \
"${HUGO_IMAGE}" \
"${USE_IMAGE}" \
--minify --destination "public" --baseURL "/"
echo "[build] Build complete: ${SITE_DIR}/public"

6
scripts/push_hugo_image.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
# Minimal build script: build the image from hugo_git/Dockerfile using hugo_git as context
docker build -t forgejo.jmopines.com/jm/hugo-git:latest .
docker push forgejo.jmopines.com/jm/hugo-git:latest

View file

@ -16,11 +16,20 @@ fi
echo "[serve] Serving site at http://localhost:${PORT}/"
echo "[serve] Press Ctrl+C to stop."
# Use the prebuilt/pushed Hugo image (hardcoded to the image created by
# scripts/push_hugo_image.sh). This simplifies the serve script and avoids
# local image build logic.
HUGO_GIT_IMAGE="forgejo.jmopines.com/jm/hugo-git:latest"
USE_IMAGE="${HUGO_GIT_IMAGE}"
# Run Hugo server. Mount the repo .git read-only so git-based info is available
# inside the container when `enableGitInfo = true`.
docker run --rm \
-v "${SITE_DIR}:/src" \
-v "${PROJECT_ROOT}/.git:/src/.git:ro" \
-w /src \
-p "${PORT}:1313" \
"${HUGO_IMAGE}" server \
"${USE_IMAGE}" server \
--bind 0.0.0.0 \
--baseURL "http://localhost:${PORT}/" \
--appendPort=false

View file

@ -0,0 +1,63 @@
---
title: 'CI/CD resume publication'
Date: 2026-04-23
draft: false
tags: ['hugo', 'git', 'workflow']
---
I am terrible at word processors / editing so I build my resume [with LaTeX templates](https://forgejo.jmopines.com/jm/resume/src/branch/main/examples/resume). I gain a pretty, highly configurable resume, but it can be a pain to modify, build, share, etc. A couple weeks ago someone pointed out to me that I forgot to update my most recent role to reflect a promotion (staff software engineer, yeahh!!). I was not at home and I had to work quite a bit to only change a word in my resume. This has always been a pain to me so I figured, why not set up a CI/CD pipeline to build and publish my resume. These are the steps I took.
# ForgeJo
### set up forgejo
This is not a tutorial, but essentially I achieved this by:
* creating a VM to host ForgeJo
* forwarding SSH port 2222 to it
* creating a caddy entry to point to it, so I can access securely from outside.
You can probably do this with GitHub.
### set up forgejo runners
On the same host, you can start a forgejo-runner, just like runners in gitlab, and register the runner to your forgejo instance. It will ask you to register and you pass a token that you generated from the ForgeJo instance.
# actions
This is the nice part. To set up CI/CD pipeline, simply create a `.forgejo/workflows/build.yml` and specify your pipeline there. In my case I want to
* build my resume
* push it as an artifact on ForgeJo -- turns out this is complicated and I only managed to push a zip archive.
* push my resume to the server that will host it.
The full config can be found [here](https://forgejo.jmopines.com/jm/resume/src/branch/main/.forgejo/workflows/build.yml). Here is a summary:
```yaml
name: Build Resume
on: [push]
jobs:
build:
runs-on: docker
steps:
- name: Checkout
run: |
echo ${{ github.server_url }}
echo ${{ github.repository }}
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}.git .
- name: Build
run: docker run --rm -w /doc -v $PWD:/doc thomasweise/docker-texlive-full bash /doc/build.sh
- name: Deploy
run: |
echo "${{ secrets.FORGEJO_SSH }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
scp -i /tmp/deploy_key -o StrictHostKeyChecking=no examples/resume_jm_tremblay_*.pdf ${{ vars.JMOPINES_USER }}@${{ vars.JMOPINES_IP }}:/var/www/jmopines/resume/
rm /tmp/deploy_key
```
# Hugo
In Hugo, I (well, the AI), added this to hugo.toml to have a header pointing to the latest resume. the url is the relative path with respect to the site root.
```toml
[[languages.en.menu.main]]
identifier = "resume"
name = "Resume"
url = "/resume/resume_jm_tremblay_latest.pdf"
weight = 3
```
That's it! now on every build of my resume, a new copy get pushed to serve to my website!

View file

@ -9,7 +9,7 @@
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{ end }}
{{ $paginator := .Paginate $PageContext.RegularPages }}
{{ $paginator := .Paginate ($PageContext.RegularPages.ByLastmod.Reverse) }}
{{ range $paginator.Pages }}
<article class="post on-list">

View file

@ -0,0 +1,13 @@
{{ define "main" }}
<div class="posts">
{{ $paginator := .Paginate (.Pages.ByLastmod.Reverse) }}
{{ range $paginator.Pages }}
<article class="post on-list">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<div class="post-meta"><time class="post-date">{{ partial "post-date" . }}</time></div>
{{ if .Summary }}<div class="post-content">{{ .Summary }}</div>{{ end }}
</article>
{{ end }}
{{ partial "pagination.html" . }}
</div>
{{ end }}

View file

@ -0,0 +1,7 @@
{{ define "main" }}
<article class="post">
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<div class="post-meta"><time class="post-date">{{ partial "post-date" . }}</time></div>
<div class="post-content">{{ .Content }}</div>
</article>
{{ end }}

View file

@ -0,0 +1,20 @@
{{/*
Render creation and modified dates for a post.
- Always show the creation date (`.Date`) in YYYY-MM-DD.
- If `.Lastmod` exists and differs (by date) from `.Date`, show
an "Updated: YYYY-MM-DD" suffix.
*/}}
{{- $created := .Date -}}
{{- $createdFmt := $created.Format "2006-01-02" -}}
{{- $modified := .Lastmod -}}
{{- /* Print creation date */ -}}
{{- printf "%s" $createdFmt -}}
{{- /* If we have a modified timestamp, format and show when different */ -}}
{{- if $modified -}}
{{- $modifiedFmt := $modified.Format "2006-01-02" -}}
{{- if ne $modifiedFmt $createdFmt -}}
{{- printf " [Updated: %s]" $modifiedFmt -}}
{{- end -}}
{{- end -}}