Skip to content

Commit

Permalink
feat: add initial Hugo site and CI configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Roald Nefs <[email protected]>
  • Loading branch information
roaldnefs committed Aug 17, 2024
1 parent 6349122 commit 8f65215
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Configure Git for GitHub
run: |
git config --global user.name "Roald Nefs"
git config --global user.email "[email protected]"
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
submodules: true

- name: Set up Hugo
env:
HUGO_VERSION: 0.112.0
run: |
echo "installing hugo $HUGO_VERSION"
curl -sL -o /tmp/hugo.deb \
https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb && \
sudo dpkg -i /tmp/hugo.deb && \
rm /tmp/hugo.deb
- name: Publish
env:
REPOSITORY: "https://roaldnefs:${{ secrets.GITHUB_TOKEN }}@github.com/bsidesgrunn/bsidesgrunn.org.git"
run: ./publish.sh
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public/
resources/_gen/
.hugo_build.lock

node_modules/
package-lock.json

.DS_Store
5 changes: 5 additions & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ .Date }}
draft = true
+++
3 changes: 3 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
baseURL = 'https://bsidesgrunn.org/'
languageCode = 'en-us'
title = 'BSides Groningen'
30 changes: 30 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

if [ "`git status -s`" ]
then
echo "[-] The working directory is dirty. Please commit any pending changes."
exit 1;
fi

echo "[+] Deleting old publication."
rm -rf public
mkdir public
git worktree prune
rm -rf .git/worktrees/public/

echo "[+] Checking out gh-pages branch into public."
git worktree add -B gh-pages public origin/gh-pages

echo "[+] Removing existing files."
rm -rf public/*

echo "[+] Generating site."
hugo

echo "[+] Updating gh-pages branch."
cd public && git add --all && git commit -m "chore: publishing to gh-pages (publish.sh)"

echo "[+] Pushing to GitHub."
git push -f ${REPOSITORY:-origin} gh-pages

echo "[+] Updates have been published."

0 comments on commit 8f65215

Please sign in to comment.