Skip to content

Commit

Permalink
finalize automation/CI workflows
Browse files Browse the repository at this point in the history
- build markdown/HTML versions, use separate makefile targets/hecat configuration files for each export format/push task
- add non-free.md generation step to markdown export hecat configuration file
- add makefile targets to push exports to https://github.com/awesome-selfhosted/awesome-selfhosted and https://github.com/nodiscc/awesome-selfhosted-html-preview
- install: install sphinx <7 directly using pip since it can't be installed from setup.py sphinx-doc/sphinx#11130
- pin sphinx to version <7, sphinx-design is not compatible with sphinx 7 executablebooks/sphinx-design#130
- add sphinx configuration file
  • Loading branch information
nodiscc committed Jul 24, 2023
1 parent 56a445d commit 0d1088b
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: make awesome_lint
- run: make export
- run: make export_markdown
- run: make export_html
# - run: make push_markdown
# - run: make push_html
2 changes: 1 addition & 1 deletion .github/workflows/daily-checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dead links and unmaintained projects checks
name: dead links/unmaintained projects checks

on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: make awesome_lint
- run: make export
- run: make export_markdown
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
awesome-selfhosted/
awesome-selfhosted-html-preview/
html/
.venv/
12 changes: 6 additions & 6 deletions .hecat/export.yml → .hecat/export-html.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
steps:
- name: export YAML data to awesome-selfhosted markdown
module: exporters/markdown_singlepage
- name: export YAML data to multi-page markdown site
module: exporters/markdown_multipage
module_options:
source_directory: ./
output_directory: awesome-selfhosted
output_file: README.md
back_to_top_url: '#awesome-selfhosted'
# authors_file: AUTHORS.md
output_directory: html
exclude_licenses:
- '⊘ Proprietary'
- 'BUSL-1.1'
Expand All @@ -16,3 +13,6 @@ steps:
- 'Commons-Clause'
- 'DPL'
- 'SSPL-1.0'
- 'DPL'
- 'Elastic-1.0'
- 'Elastic-2.0'
46 changes: 46 additions & 0 deletions .hecat/export-markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
steps:
- name: export YAML data to single-page markdown
module: exporters/markdown_singlepage
module_options:
source_directory: ./
output_directory: awesome-selfhosted
output_file: README.md
markdown_header: markdown/header.md
markdown_footer: markdown/footer.md
back_to_top_url: '#awesome-selfhosted'
exclude_licenses:
- '⊘ Proprietary'
- 'BUSL-1.1'
- 'CC-BY-NC-4.0'
- 'CC-BY-NC-SA-3.0'
- 'CC-BY-ND-3.0'
- 'Commons-Clause'
- 'DPL'
- 'SSPL-1.0'
- 'DPL'
- 'Elastic-1.0'
- 'Elastic-2.0'

- name: export YAML data to single-page markdown (non-free)
module: exporters/markdown_singlepage
module_options:
source_directory: ./
output_directory: awesome-selfhosted
output_file: non-free.md
markdown_header: markdown/non-free-header.md
licenses_file: licenses-nonfree.yml
back_to_top_url: '##awesome-selfhosted---non-free-software'
render_empty_categories: False
render_category_headers: False
include_licenses:
- '⊘ Proprietary'
- 'BUSL-1.1'
- 'CC-BY-NC-4.0'
- 'CC-BY-NC-SA-3.0'
- 'CC-BY-ND-3.0'
- 'Commons-Clause'
- 'DPL'
- 'SSPL-1.0'
- 'DPL'
- 'Elastic-1.0'
- 'Elastic-2.0'
38 changes: 29 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# requirements: git bash make python3-pip python3-venv
SHELL := /bin/bash

.PHONY: install # install build tools in a virtualenv
install:
python3 -m venv .venv
source .venv/bin/activate && \
pip3 install wheel && \
pip3 install --force git+https://github.com/nodiscc/hecat.git@master
pip3 install --force git+https://github.com/nodiscc/hecat.git@master 'sphinx<7'

.PHONY: import # import data from original list at https://github.com/awesome-selfhosted/awesome-selfhosted
import: install
rm -rf awesome-selfhosted && git clone --depth=1 https://github.com/awesome-selfhosted/awesome-selfhosted
import: clean install
git clone --depth=1 https://github.com/awesome-selfhosted/awesome-selfhosted
cp awesome-selfhosted/.github/.mailmap .mailmap
cp awesome-selfhosted/AUTHORS AUTHORS
rm -rf tags/ software/ platforms/
Expand All @@ -27,13 +28,32 @@ awesome_lint: install
source .venv/bin/activate && \
hecat --config .hecat/awesome-lint.yml

.PHONY: export # export markdown singlepage document from yaml data
export: install
rm -rf awesome-selfhosted && git clone https://github.com/awesome-selfhosted/awesome-selfhosted
source .venv/bin/activate && \
hecat --config .hecat/export.yml
.PHONY: export_markdown # render markdown export from YAML data (https://github.com/awesome-selfhosted/awesome-selfhosted)
export_markdown: clean install
git clone https://github.com/awesome-selfhosted/awesome-selfhosted
source .venv/bin/activate && hecat --config .hecat/export-markdown.yml
cd awesome-selfhosted && git diff --color=always

.PHONY: export_html # render HTML export from YAML data (https://nodiscc.github.io/awesome-selfhosted-html-preview/)
export_html: clean install
git clone https://github.com/nodiscc/awesome-selfhosted-html-preview
mkdir html && source .venv/bin/activate && hecat --config .hecat/export-html.yml
source .venv/bin/activate && sphinx-build -b html -c ./ html/md/ html/html/
rm -rf html/html/.buildinfo html/html/objects.inv html/html/.doctrees awesome-selfhosted-html-preview/*

.PHONY: push_markdown # commit and push changes to the markdown repository
push_markdown:
cd awesome-selfhosted && git config user.name awesome-selfhosted-bot && git config user.email [email protected]
cd awesome-selfhosted && git add . && (git diff-index --quiet HEAD || git commit -m "[bot] build markdown repository")
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:
mv html/html/* awesome-selfhosted-html-preview/
cd awesome-selfhosted-html-preview/ && git config user.name awesome-selfhosted-bot && git config user.email [email protected]
cd awesome-selfhosted-html-preview/ && git add . && (git diff-index --quiet HEAD || git commit --amend -m "[bot] build HTML site")
cd awesome-selfhosted-html-preview/ && git push -f

.PHONY: url_check # check URLs for dead links or other connection problems
url_check: install
source .venv/bin/activate && \
Expand All @@ -46,7 +66,7 @@ authors:

.PHONY: clean # clean files generated by automated tasks
clean:
rm -rf awesome-selfhosted
rm -rf awesome-selfhosted/ awesome-selfhosted-html-preview/ html/

.PHONY: help # generate list of targets with descriptions
help:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ install install build tools in a virtualenv
import import data from original list at https://github.com/awesome-selfhosted/awesome-selfhosted
update_metadata update metadata from project repositories/API
awesome_lint check data against awesome-selfhosted guidelines
export export markdown singlepage document from yaml data
export_markdown render markdown export from YAML data (https://github.com/awesome-selfhosted/awesome-selfhosted)
export_html render HTML export from YAML data (https://nodiscc.github.io/awesome-selfhosted-html-preview/)
push_markdown commit and push changes to the markdown repository
push_html commit and push changes to the HTML site repository (amend previous commit and force-push)
url_check check URLs for dead links or other connection problems
authors update the AUTHORS file
clean clean files generated by automated tasks
Expand Down
49 changes: 49 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Configuration file for the Sphinx documentation builder.
# https://www.sphinx-doc.org/en/master/usage/configuration.html
project = 'awesome-selfhosted'
author = 'awesome-selfhosted community'
version = '1.0.0'
release = '1.0.0'
copyright = '2015-2023, the awesome-selfhosted community'
language = 'en'
html_title = 'awesome-selfhosted'
html_theme = 'furo'
html_show_sphinx = False
html_show_search_summary = True
html_copy_source = False
html_show_copyright = True
html_use_opensearch = 'https://nodiscc.github.io/awesome-selfhosted-html-preview/'
html_favicon = '_static/favicon.ico'
html_logo = '_static/logo.svg'
extensions = ['myst_parser', 'sphinx_design']
source_suffix = ['.md']
templates_path = ['_templates']
exclude_patterns = []
html_static_path = ['_static']

# myst-parser configuration (https://myst-parser.readthedocs.io/en/latest/configuration.html)
myst_enable_extensions = ['fieldlist']
myst_html_meta = {
"description lang=en": "A list of Free Software network services and web applications which can be hosted on your own servers",
"charset": "UTF-8"
}

# theme configuration (https://pradyunsg.me/furo/customisation/)
html_theme_options = {
"top_of_page_button": None,
# "announcement": "Example announcement!"
"source_repository": "https://github.com/awesome-selfhosted/awesome-selfhosted-data",
"source_branch": "master",
"footer_icons": [
{
"name": "GitHub",
"url": "https://github.com/awesome-selfhosted/awesome-selfhosted-data",
"html": """
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
</svg>
""",
"class": "",
},
]
}

0 comments on commit 0d1088b

Please sign in to comment.