[Blog] Installing MC-modpack without CurseForge #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Markdown Indexing | |
on: push | |
jobs: | |
indexing: | |
name: Build and Push Index | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build Markdown Index | |
run: | | |
rm -rf index | |
mkdir -p index | |
prefix_delim="/" | |
filename_delim="--" | |
for dir in *; do | |
if [ -d "$dir" ] && [ "$dir" != "index" ]; then | |
index="index/$dir.md" | |
echo "# ${dir^}" > $index | |
echo "" >> $index | |
for entry in "$dir"/*.md; do | |
if [ -f "$entry" ]; then | |
read -r headerline < $entry | |
filename=${entry#*$prefix_delim} | |
date=${filename%%$filename_delim*} | |
pre_ext_len=${#entry}-3 | |
echo "- [${headerline:2} ($date)](/${entry::pre_ext_len})" >> $index | |
fi | |
done | |
fi | |
done | |
- name: Push Markdown Index | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
git config --global user.name 'dotCliqe CI' | |
git config --global user.email 'ci@dotclique.com' | |
git add ./index | |
git commit -m "Update markdown index" | |
git push | |
else | |
echo "Index unchanged" | |
fi |