diff --git a/.github/workflows/anki.yml b/.github/workflows/anki.yml new file mode 100644 index 00000000..8d79b76a --- /dev/null +++ b/.github/workflows/anki.yml @@ -0,0 +1,43 @@ +name: Create Anki Decks release from markdown + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + convert_via_md2apkg: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: npm install -g md2apkg + - run: mkdir output + - run: for f in [A-Z]*[A-Z]-[A-Z]*[A-Z]/README.md; do d=$(echo ${f} | awk -F/ '{print $1}'); md2apkg -o output/${d}.apkg ${f}; done + - uses: actions/upload-artifact@master # upload pdfs as an artifact + with: + name: output + path: output + release_decks: + runs-on: ubuntu-20.04 + needs: convert_via_md2apkg + if: github.ref == 'refs/heads/main' # only publish if commited to the main branch + steps: + - name: Retrieve saved Docker image + uses: actions/download-artifact@v2 + with: + name: output + path: output + - uses: meeDamian/github-release@2.0 # create/override a release and attach apkgs + with: + token: ${{ secrets.ACCESS_TOKEN }} + tag: anki-release + name: Anki Decks + body: Dieses Release wurde automatisch erstellt + gzip: false + files: output/[A-Z]*[A-Z]-[A-Z]*[A-Z].apkg + allow_override: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..1dac3c36 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +name: markdownlint + +on: + push: + branches: + - main + pull_request: + +jobs: + linting: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@main + - name: Run mdl + uses: actionshub/markdownlint@main diff --git a/.github/workflows/pandoc.yml b/.github/workflows/pandoc.yml new file mode 100644 index 00000000..9c171f09 --- /dev/null +++ b/.github/workflows/pandoc.yml @@ -0,0 +1,47 @@ +name: Create PDF release from markdown + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + convert_via_pandoc: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - run: | + mkdir .old && + rsync -vr ./* .old/ --exclude .old && + for f in [A-Z]*[A-Z]-[A-Z]*[A-Z]/README.md; do awk '/!\[/{gsub(//,"}")};{gsub("","\\pagebreak")};{gsub("","\\newpage")};{gsub("","\\clearpage")};{gsub("","...")};{print}' .old/${f} > ${f} ; done + - run: | + mkdir output + - uses: docker://rstropek/pandoc-latex:latest # generate ABWL-LEDER pdf + with: + entrypoint: /bin/sh + args: -c "for f in [A-Z]*[A-Z]-[A-Z]*[A-Z]/README.md; do d=$(echo ${f} | awk -F/ '{print $1}'); echo ${d}+${f}; pandoc --output=output/${d}.pdf --resource-path=${d}/ --template https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/v2.0.0/eisvogel.tex --pdf-engine=xelatex --listings -f markdown+raw_tex --verbose ${f}; done" + - uses: actions/upload-artifact@master # upload pdfs as an artifact + with: + name: output + path: output + release_pdfs: + runs-on: ubuntu-20.04 + needs: convert_via_pandoc + if: github.ref == 'refs/heads/main' # only publish if commited to the main branch + steps: + - name: Retrieve saved Docker image + uses: actions/download-artifact@v2 + with: + name: output + path: output + - uses: meeDamian/github-release@2.0 # create/override a release and attach a pdf + with: + token: ${{ secrets.ACCESS_TOKEN }} + tag: pdf-release + name: PDFs + body: Dieses Release wurde automatisch erstellt + gzip: false + files: output/[A-Z]*[A-Z]-[A-Z]*[A-Z].pdf + allow_override: true diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml new file mode 100644 index 00000000..c51de66e --- /dev/null +++ b/.github/workflows/toc.yml @@ -0,0 +1,17 @@ +on: + pull_request: + branches: + - main +name: TOC Generator +jobs: + generateTOC: + runs-on: ubuntu-latest + steps: + - uses: technote-space/toc-generator@v4.1.2 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + TOC_TITLE: "**Inhaltsverzeichnis**" + # Git commit name. + COMMIT_NAME: "TOCGEN" + CREATE_PR: false + TARGET_PATHS: "./[A-Z]*[A-Z]-[A-Z]*[A-Z]/README.md" diff --git a/.gitignore b/.gitignore index cc3369af..8b9abfdc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ # root-level README ############################################################ !/README.md +!/.mdl.rb +!/.mdlrc + # github workflows ############################################################# diff --git a/.mdl.rb b/.mdl.rb new file mode 100644 index 00000000..239f9342 --- /dev/null +++ b/.mdl.rb @@ -0,0 +1,20 @@ +# Enable all rules by default +all + +# Allow any Heading styles +exclude_rule 'MD003' + +# First line of the file is not required to be the top-level heading +exclude_rule 'MD041' + +# Allow the use of emphasis for small-headers +exclude_rule 'MD036' + +# Allow multiple top-level headers per file +exclude_rule 'MD025' + +# Extend line length, since each sentence should be on a separate line. +rule 'MD013', :line_length => 200 + +# Prefix ordered lists with incremental numbers instead of all ones +rule 'MD029', style: 'ordered' diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 00000000..d068c66d --- /dev/null +++ b/.mdlrc @@ -0,0 +1 @@ +style '.mdl.rb'