Skip to content

Hugo - Add Theme

Hugo - Add Theme #1

name: Hugo - Add Theme
# Original source: htts://github.com/boochtek/hugo-add-theme
# Original author: Craig Buchek (@booch) with help from ChatGPT.
on:
# Run this workflow manually from the Actions tab.
workflow_dispatch:
inputs:
theme_url:
description: "URL of the theme to add"
required: true
type: string
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
gugo-add-theme:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.120.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
fetch-depth: 0
- name: Add git submodule pointing at the theme
run: |
THEME_URL="${{ inputs.theme_url }}"
THEME_NAME="$(basename ${THEME_URL%.*})"
git submodule add "$THEME_URL" "themes/${THEME_NAME}"
git submodule update --init --recursive
- name: Add theme to config # TODO
run: |
echo "OK"