Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Kariton committed Jul 21, 2024
0 parents commit 92ee9ae
Show file tree
Hide file tree
Showing 252 changed files with 11,370 additions and 0 deletions.
1 change: 1 addition & 0 deletions .frontmatter/database/mediaDb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"users":{"timo jaspers":{"documents":{"hugo":{"jaspers.it":{"content":{"de":{"404":{},"authors":{"timo-jaspers":{}},"categories":{},"doc":{},"tags":{},"series":{}},"en":{"authors":{"timo-jaspers":{}},"tags":{},"series":{},"categories":{}}},"assets":{"logo":{"truenas":{},"kvm":{},"lxc":{},"hugo":{}},"img":{"network":{}}},"resources":{"_gen":{"images":{"de":{"authors":{"timo-jaspers":{}}}}}}}}}}}}
1 change: 1 addition & 0 deletions .frontmatter/database/pinnedItemsDb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions .frontmatter/database/taxonomyDb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Archives
*.7z filter=lfs diff=lfs merge=lfs -text
*.br filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

# Documents
*.pdf filter=lfs diff=lfs merge=lfs -text

# Images
*.svg !text !filter !merge !diff
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text

# Fonts
*.woff filter=lfs diff=lfs merge=lfs -text
*.woff2 filter=lfs diff=lfs merge=lfs -text
85 changes: 85 additions & 0 deletions .github/workflows/build-hugo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Hugo build

on:
push:
branches: ["main"]
paths:
- '.github/**'
- 'assets/**'
- 'config/**'
- 'content/**'
- 'layouts/**'
- 'resources/**'
- 'static/**'
- 'themes/**'
- 'package.json'
- 'pagefind.yaml'
- 'postcss.config.js'

workflow_dispatch:

concurrency:
group: "hugo"
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.128.2
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Create LFS file list
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id

- name: LFS Cache
uses: actions/cache@v3
with:
path: .git/lfs/objects
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
restore-keys: |
${{ runner.os }}-lfs
- name: Git LFS Pull
run: git lfs pull

- name: Fetch resources directory from cache
uses: actions/cache@v3
with:
path: resources
key: ${{ runner.os }}-hugo-resources-directory-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-hugo-resources-directory
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify
- name: Run pagefind
run: npm_config_yes=true npx pagefind

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: public
path: ./public
if-no-files-found: error
54 changes: 54 additions & 0 deletions .github/workflows/deploy-hetzner_webhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deployment to Hetzner Webhost

on:
workflow_run:
workflows: ["Hugo build"]
types:
- completed

concurrency:
group: "hugo"
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install lftp
run: |
sudo apt update &&\
sudo apt install lftp -y
- name: Download artifact
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
name: public
path: ./public

- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${SSH_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 22 -t ed25519 "${HOST}" >> ~/.ssh/known_hosts
env:
SSH_KEY: ${{ secrets.SFTP_SSH_KEY }}
HOST: ${{ secrets.SFTP_HOST }}

- name: Deploy to Hetzner Webhosting
run: |
lftp -e " \
set sftp:connect-program 'ssh -a -x -i ~/.ssh/id_ed25519'; \
mirror -vv --no-empty-dirs --no-symlinks --delete --reverse ./public ${DIRECTORY}; \
bye \
" -u "${USERNAME}", sftp://${HOST}
env:
USERNAME: ${{ secrets.SFTP_USERNAME }}
HOST: ${{ secrets.SFTP_HOST }}
DIRECTORY: ${{ secrets.SFTP_DIRECTORY }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.env

### Hugo template
# Generated files by hugo
public
resources
.hugo_build.lock
hugo_stats.json
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "themes/github.com/bowman2001/perplex"]
path = themes/github.com/bowman2001/perplex
url = https://github.com/bowman2001/perplex.git
[submodule "themes/github.com/kariton/perplex"]
path = themes/github.com/kariton/perplex
url = git@github.com:kariton/perplex.git
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files.autoSave": "onFocusChange",
"files.autoSaveWhenNoErrors": true,
"files.watcherExclude": {
"themes/**": true
},
"files.readonlyInclude": {
"themes/**": true
}
}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#####################################################################
# Build Stage #
#####################################################################
FROM hugomods/hugo:exts AS builder

ARG HUGO_ENV
ENV HUGO_ENV ${HUGO_ENV}
ARG HUGO_ENVIRONMENT
ENV HUGO_ENVIRONMENT ${HUGO_ENVIRONMENT}

COPY . /src
RUN hugo --gc --minify

# Generate pagefind index
RUN npm_config_yes=true npx pagefind

#####################################################################
# Deploy #
#####################################################################
FROM hugomods/hugo:nginx

COPY --from=builder /src/public /site
47 changes: 47 additions & 0 deletions Dockerfile-deploy-hetzner-webhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#####################################################################
# Build Stage #
#####################################################################
FROM hugomods/hugo:exts AS builder

ARG HUGO_ENV
ENV HUGO_ENV ${HUGO_ENV}
ARG HUGO_ENVIRONMENT
ENV HUGO_ENVIRONMENT ${HUGO_ENVIRONMENT}

COPY . /src
RUN hugo --gc --minify

# Generate pagefind index
RUN npm_config_yes=true npx pagefind

#####################################################################
# Publish #
#####################################################################
FROM alpine:latest

ARG SFTP_USERNAME
ENV SFTP_USERNAME ${SFTP_USERNAME}
ARG SFTP_SSH_KEY
ENV SFTP_SSH_KEY ${SFTP_SSH_KEY}
ARG SFTP_HOST
ENV SFTP_HOST ${SFTP_HOST}
ARG SFTP_DIRECTORY
ENV SFTP_DIRECTORY ${SFTP_DIRECTORY}

RUN apk add --update-cache \
openssh \
lftp \
&& rm -rf /var/cache/apk/*

RUN mkdir -p ~/.ssh &&\
echo -e "${SFTP_SSH_KEY}" > ~/.ssh/id_ed25519 &&\
chmod 600 ~/.ssh/id_ed25519 && \
ssh-keyscan -p 22 -t ed25519 "${SFTP_HOST}" >> ~/.ssh/known_hosts

COPY --from=builder /src/public /public

RUN lftp -e " \
set sftp:connect-program 'ssh -a -x -i ~/.ssh/id_ed25519'; \
mirror -vv --no-empty-dirs --no-symlinks --delete --reverse ./public ${SFTP_DIRECTORY}; \
bye \
" -u "${SFTP_USERNAME}", sftp://${SFTP_HOST}
Loading

0 comments on commit 92ee9ae

Please sign in to comment.