fix: task output problems #31
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: Documentation Generation | |
on: | |
push: | |
tags-ignore: | |
# ignore all tags | |
- '**' | |
branches: | |
# run for all branches | |
- '**' | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-22.04 | |
name: Generate Documentation | |
env: | |
TEMP_README: "__temp_readme.md" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
- name: Prepare markdown file | |
run: | | |
TEMP_CONFIG="$(mktemp)" | |
# Retrieve default config and put it in a temp file. | |
{ | |
echo '```lua' | |
awk '/DOCGEN_END/{f=0} f; /DOCGEN_START/{f=1}' lua/projector/config.lua | |
echo '```' | |
} > "$TEMP_CONFIG" | |
# Insert the default config between DOCGEN_CONFIG tags in the README. | |
# And remove stuff between DOCGEN_IGNORE_START and DOCGEN_IGNORE_END tags from README. | |
{ | |
sed -e ' | |
/DOCGEN_CONFIG_START/,/DOCGEN_CONFIG_END/!b | |
/DOCGEN_CONFIG_START/r '"$TEMP_CONFIG"' | |
/DOCGEN_CONFIG_END:/!d | |
' <(sed '/DOCGEN_IGNORE_START/,/DOCGEN_IGNORE_END/d' README.md) | |
} > "$TEMP_README" | |
- name: Generate vimdoc | |
uses: kdheepak/[email protected] | |
with: | |
vimdoc: projector | |
pandoc: "${{ env.TEMP_README }}" | |
toc: true | |
description: "Extensible code-runner/project-configurator" | |
treesitter: true | |
ignorerawblocks: true | |
docmappingprojectname: false | |
- name: Commit the Generated Help | |
uses: EndBug/add-and-commit@v9 | |
if: github.event_name == 'push' | |
with: | |
add: doc/projector.txt | |
author_name: Github Actions | |
author_email: [email protected] | |
message: "[docgen] Update doc/projector.txt" | |
pull: --rebase --autostash | |
reference-docs: | |
name: Generate Reference Docs | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generating help | |
shell: bash | |
run: | | |
curl -Lq https://github.com/numToStr/lemmy-help/releases/latest/download/lemmy-help-x86_64-unknown-linux-gnu.tar.gz | tar xz | |
./lemmy-help lua/projector.lua lua/projector/{config,doc,loaders/init,outputs/doc}.lua --expand-opt > doc/projector-reference.txt | |
- name: Commit the Generated Docs | |
uses: EndBug/add-and-commit@v9 | |
if: github.event_name == 'push' | |
with: | |
add: doc/projector-reference.txt | |
author_name: Github Actions | |
author_email: [email protected] | |
message: "[docgen] Update doc/projector-reference.txt" | |
pull: --rebase --autostash |