Skip to content

Build content

Build content #17

Workflow file for this run

name: Build content
on:
push:
paths:
- db/jks.csv
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
runs-on: ubuntu-slim
env:
HUGO_VERSION: 0.163.1
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@v6
with:
# lfs: true
submodules: recursive
- name: Build piesne
working-directory: hugo
run: |
# Cleanup
rm -fr content/$CONTENT_HOME public/*
# Build
while IFS="," read -r piesen strofa text; do
text=${text//\"/}
CONTENT_FILE="${CONTENT_HOME}/${piesen}.md"
if [[ $strofa -eq 0 ]]; then
hugo new content $CONTENT_FILE -f
sed -i "s|title: .*|title: \"${piesen}. ${text}\"|" content/$CONTENT_FILE
continue
fi
echo "${strofa}. ${text}" >>content/$CONTENT_FILE
done <$SOURCE_DB
env:
CONTENT_HOME: piesne
SOURCE_DB: ${{ github.workspace }}/db/jks.csv
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
commit-message: "chore: update content"
delete-branch: true
title: Update content