-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linter, TOC, Pandoc und Anki Action (#2)
- Loading branch information
Showing
7 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(/-->/,"}")};{gsub("<!--pagebreak-->","\\pagebreak")};{gsub("<!--newpage-->","\\newpage")};{gsub("<!--clearpage-->","\\clearpage")};{gsub("<!----------","---")};{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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
style '.mdl.rb' |