-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add initial Hugo site and CI configuration
Signed-off-by: Roald Nefs <[email protected]>
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
+++ | ||
title = '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
date = {{ .Date }} | ||
draft = true | ||
+++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
baseURL = 'https://bsidesgrunn.org/' | ||
languageCode = 'en-us' | ||
title = 'BSides Groningen' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |