Skip to content

Update Český demokratický, katolický a imaginativní proud prózy 1. po… #252

Update Český demokratický, katolický a imaginativní proud prózy 1. po…

Update Český demokratický, katolický a imaginativní proud prózy 1. po… #252

Workflow file for this run

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Add index.md files for each directory
run: |
#!/bin/bash
for dir in */; do
if [[ -f "${dir}index.md" ]]; then
rm -f "${dir}index.md"
fi
printf "## Obsahuje témata: \n\n" > "${dir}index.md"
for file in "${dir}"*; do
FILENAME=$(printf "%s" "${file##*/}")
EXTENSION=$(printf "%s" "${FILENAME##*.}")
FILENAME=$(printf "%s" "${FILENAME%.*}")
if [[ -f "${file}" && "${FILENAME}" != "README" && "${FILENAME}" != "index" && "$EXTENSION" == "md" ]]; then
printf "### [%s](%s) \n" "${FILENAME}" "${FILENAME}" >> "${dir}index.md"
fi
done
done
- name: Add front matter to markdown files (for Jekyll to notice)
run: |
find . -type f -name "*.md" ! -name "README.md" -print0 | xargs -0 -I {} sh -c '
if ! grep -q "^---$" "{}"; then
parentpath=$(dirname "{}")
parentparentpath=$(dirname "$parentpath")
folderName=$(basename "$(dirname "{}")")
file="{}"
FILENAME=$(printf "%s" "${file##*/}")
siteTitle=$(awk "NR==1{print substr(\$0, 3)}" "{}" | tr -d ":")
sed -i "1s/^/---\\n/" "{}"
if [ "$FILENAME" = "index.md" ]; then
sed -i "2s/^/toc: false\\n/" "{}"
else
sed -i "2s/^/toc: true\\n/" "{}"
fi
sed -i "3s/^/layout: dark\\n/" "{}"
if [ "$FILENAME" = "index.md" ]; then
sed -i "4s/^/title: $folderName \\n/" "{}"
else
sed -i "4s|^|title: $FILENAME \\n|" "{}"
fi
if [ "$FILENAME" = "index.md" ]; then
sed -i "5s|^|parent_url: $parentparentpath \\n|" "{}"
else
sed -i "5s|^|parent_url: $parentpath \\n|" "{}"
fi
sed -i "6s/^/category: $folderName \\n/" "{}"
sed -i "7s/^/---\\n/" "{}"
fi
'
- name: format markdown files headers so Jekyll can read them correctly
run: |
find . -type f -name "*.md" ! -name "README.md" -print0 | xargs -0 -I {} sh -c '
if grep -q "^#" "{}"; then
sed -i -e "/^$/!s/^#/\n&/" "{}"
awk "/./ { e=0 } /^$/ { e += 1 } e <= 1" < "{}" > "temp" && mv temp "{}"
awk "/./ { e=0 } /^$/ { e += 1 } e <= 1" < "{}" > "temp" && mv temp "{}"
awk "/./ { e=0 } /^$/ { e += 1 } e <= 1" < "{}" > "temp" && mv temp "{}"
fi
'
- name: Commit changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "tpkowastaken"
git add .
git commit -m "Build Jekyll site" --allow-empty
git push https://${{ secrets.TOKEN }}@github.com/tpkowastaken/Zapisky-CJ-SS.git HEAD:main
# Build job
- name: Checkout jekyll theme repo
uses: actions/checkout@v3
with:
repository: tpkowastaken/jekyll-dark-github-theme
path: repo-with-jekyll-theme
- name: Copy new files from first repo to second repo
run: |
cp -n -R repo-with-jekyll-theme/* ./
rm -rf repo-with-jekyll-theme/
shell: bash
- name: Set Permissions
run: |
sudo chown -R $USER .
sudo chmod -R 777 .
- name: Build with Jekyll
uses: docker://jekyll/builder:latest
with:
entrypoint: jekyll
args: build --config _config.yml --source ./ --destination ./_site --incremental
- name: Upload artifact to view
uses: actions/upload-artifact@v3
with:
name: site
path: _site
- name: Upload artifact for github pages
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2