2023-07-23 00:22:37 +00:00
# requirements: git bash make python3-pip python3-venv
2022-04-29 11:30:26 +00:00
SHELL := /bin/bash
2023-08-22 13:12:34 +00:00
MARKDOWN_REPOSITORY = awesome-selfhosted/awesome-selfhosted
HTML_REPOSITORY = awesome-selfhosted/awesome-selfhosted-html
2022-04-29 11:30:26 +00:00
2022-06-05 15:54:51 +00:00
.PHONY : install # install build tools in a virtualenv
2022-04-29 11:30:26 +00:00
install :
python3 -m venv .venv
source .venv/bin/activate && \
2022-06-05 17:36:25 +00:00
pip3 install wheel && \
2023-08-19 13:14:27 +00:00
pip3 install --force git+https://github.com/nodiscc/hecat.git@1.1.1
2022-04-29 11:30:26 +00:00
.PHONY : import # import data from original list at https://github.com/awesome-selfhosted/awesome-selfhosted
2023-07-23 00:22:37 +00:00
import : clean install
git clone --depth= 1 https://github.com/awesome-selfhosted/awesome-selfhosted
2023-07-15 17:29:21 +00:00
cp awesome-selfhosted/AUTHORS AUTHORS
2022-06-04 12:50:26 +00:00
rm -rf tags/ software/ platforms/
mkdir -p tags/ software/ platforms/
2022-04-29 11:30:26 +00:00
source .venv/bin/activate && \
2022-12-05 18:14:59 +00:00
hecat --config .hecat/import.yml
2022-04-29 11:30:26 +00:00
2022-08-08 20:48:52 +00:00
.PHONY : update_metadata # update metadata from project repositories/API
2023-07-24 18:35:24 +00:00
update_metadata :
2022-06-04 13:01:18 +00:00
source .venv/bin/activate && \
2022-12-05 18:14:59 +00:00
hecat --config .hecat/update-metadata.yml
2022-08-08 20:48:52 +00:00
.PHONY : awesome_lint # check data against awesome-selfhosted guidelines
2023-07-24 18:35:24 +00:00
awesome_lint :
2022-08-08 20:48:52 +00:00
source .venv/bin/activate && \
2022-12-05 18:14:59 +00:00
hecat --config .hecat/awesome-lint.yml
2022-06-04 13:01:18 +00:00
2023-07-29 15:57:57 +00:00
.PHONY : awesome_lint # check data against awesome-selfhosted guidelines (strict)
awesome_lint_strict :
source .venv/bin/activate && \
hecat --config .hecat/awesome-lint-strict.yml
2023-07-23 00:22:37 +00:00
.PHONY : export_markdown # render markdown export from YAML data (https://github.com/awesome-selfhosted/awesome-selfhosted)
2023-07-24 18:35:24 +00:00
export_markdown :
2023-07-23 00:22:37 +00:00
rm -rf awesome-selfhosted/
git clone https://github.com/$( MARKDOWN_REPOSITORY)
source .venv/bin/activate && hecat --config .hecat/export-markdown.yml
2022-04-29 11:30:26 +00:00
cd awesome-selfhosted && git diff --color= always
2022-06-05 15:54:51 +00:00
2023-08-22 13:12:34 +00:00
.PHONY : export_html # render HTML export from YAML data (https://awesome-selfhosted.net/)
2023-07-24 18:35:24 +00:00
export_html :
2023-07-23 00:22:37 +00:00
rm -rf awesome-selfhosted-html-preview/ html/
git clone https://github.com/$( HTML_REPOSITORY)
mkdir html && source .venv/bin/activate && hecat --config .hecat/export-html.yml
2023-08-07 22:36:33 +00:00
sed -i 's|<a href="https://github.com/pradyunsg/furo">Furo</a>|<a href="https://github.com/nodiscc/hecat/">hecat</a>, <a href="https://www.sphinx-doc.org/">sphinx</a> and <a href="https://github.com/pradyunsg/furo">furo</a>. Content under <a href="https://github.com/awesome-selfhosted/awesome-selfhosted-data/blob/master/LICENSE">CC-BY-SA 3.0</a> license. <a href="https://github.com/awesome-selfhosted/awesome-selfhosted-html">Source code</a>, <a href="https://github.com/awesome-selfhosted/awesome-selfhosted-data">raw data</a>.|' .venv/lib/python*/site-packages/furo/theme/furo/page.html
2023-07-24 18:32:25 +00:00
source .venv/bin/activate && sphinx-build -b html -c .hecat/ html/md/ html/html/
2023-07-23 00:22:37 +00:00
rm -rf html/html/.buildinfo html/html/objects.inv html/html/.doctrees awesome-selfhosted-html-preview/*
2023-08-19 10:51:07 +00:00
echo "# please do not scrape this site aggressively. Source code is available at https://github.com/awesome-selfhosted/awesome-selfhosted-html. Raw data is available at https://github.com/awesome-selfhosted/awesome-selfhosted-data" >| html/html/robots.txt
2023-07-23 00:22:37 +00:00
.PHONY : push_markdown # commit and push changes to the markdown repository
push_markdown :
2023-07-28 11:53:06 +00:00
$( eval COMMIT_HASH = $( shell git rev-parse --short HEAD) )
2023-07-23 00:22:37 +00:00
cd awesome-selfhosted && git remote set-url origin git@github.com:$( MARKDOWN_REPOSITORY)
cd awesome-selfhosted && git config user.name awesome-selfhosted-bot && git config user.email github-actions@github.com
2023-07-28 11:53:06 +00:00
cd awesome-selfhosted && git add . && ( git diff-index --quiet HEAD || git commit -m " [bot] build markdown from awesome-selfhosted-data $( COMMIT_HASH) " )
2023-07-23 00:22:37 +00:00
cd awesome-selfhosted && git push -f
.PHONY : push_html # commit and push changes to the HTML site repository (amend previous commit and force-push)
push_html :
2023-07-28 11:53:06 +00:00
$( eval COMMIT_HASH = $( shell git rev-parse --short HEAD) )
2023-07-23 00:22:37 +00:00
mv html/html/* awesome-selfhosted-html-preview/
cd awesome-selfhosted-html-preview/ && git remote set-url origin git@github.com:$( HTML_REPOSITORY)
cd awesome-selfhosted-html-preview/ && git config user.name awesome-selfhosted-bot && git config user.email github-actions@github.com
2023-07-28 11:53:06 +00:00
cd awesome-selfhosted-html-preview/ && git add . && ( git diff-index --quiet HEAD || git commit --amend -m " [bot] build HTML from awesome-selfhosted-data $( COMMIT_HASH) " )
2023-07-23 00:22:37 +00:00
cd awesome-selfhosted-html-preview/ && git push -f
2023-01-24 16:51:03 +00:00
.PHONY : url_check # check URLs for dead links or other connection problems
2023-07-24 18:35:24 +00:00
url_check :
2023-01-24 16:51:03 +00:00
source .venv/bin/activate && \
hecat --config .hecat/url-check.yml
2023-07-16 15:49:15 +00:00
.PHONY : authors # update the AUTHORS file
authors :
printf "Commits|Author\n-------|---------------------------------------------------\n" > AUTHORS
2023-07-24 14:06:35 +00:00
git shortlog -sne | grep -v awesome-selfhosted-bot >> AUTHORS
2023-07-16 15:49:15 +00:00
2023-07-22 09:13:58 +00:00
.PHONY : clean # clean files generated by automated tasks
clean :
2023-07-23 00:22:37 +00:00
rm -rf awesome-selfhosted/ awesome-selfhosted-html-preview/ html/
2023-07-22 09:13:58 +00:00
2022-06-05 15:54:51 +00:00
.PHONY : help # generate list of targets with descriptions
help :
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \2/' | expand -t20