Skip to content

Deploy Hugo site to Pages #22

Deploy Hugo site to Pages

Deploy Hugo site to Pages #22

Workflow file for this run

# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '0 0 */2 * *'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
publish:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.132.2
NIM_VERSION: 2.0.8
steps:
- name: Install Nim
run: |
sudo apt update
sudo apt install build-essential -y
wget -O nim.tar.xz "https://nim-lang.org/download/nim-$NIM_VERSION-linux_x64.tar.xz"
tar -xvf nim.tar.xz
cd "nim-$NIM_VERSION"
sudo mkdir -p "/usr/include" "/usr/bin" "/etc/nim" "/usr/lib/nim"
sudo cp -r lib/ "/usr/lib/nim"
sudo cp -r compiler/ "/usr/lib/nim"
sudo cp -rf config/* -t "/etc/nim"
sudo cp -rf bin/* -t "/usr/bin"
sudo cp -rf "/usr/lib/nim/"*.h "/usr/include" || true
cd ..
rm -rf nim-*
- name: Checkout
uses: actions/checkout@main
with:
submodules: recursive
- name: Build genpkglist
run: |
git clone https://github.com/kreatolinux/src
cd src
nimble install cligen fusion -y
make genpkglist
sudo mv out/genpkglist /bin
cd ..
#- name: Add manpages to documentation
# run: |
# cd src
# for i in man/*.md; do
# genpkglist generateManpage --file="$i" --output="$GITHUB_WORKSPACE/content/docs/manpages/$(basename $i)"
# done
# cd ..
# rm -rf src
- 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: Setup Pages
id: pages
uses: actions/configure-pages@main
- name: Generate packages directory
run: |
git clone https://github.com/kreatolinux/kpkg-repo
mkdir -p "$GITHUB_WORKSPACE/content"
genpkglist generate --all --pkgPath=kpkg-repo --output="$GITHUB_WORKSPACE/content" -v
rm -rf kpkg-repo
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc --minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@main
with:
path: ./public
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: publish
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@main