From 458cbc680d6c3262798d7127f5434290e653d0dc Mon Sep 17 00:00:00 2001 From: Steph Locke Date: Tue, 1 Dec 2020 14:58:13 +0000 Subject: [PATCH 1/2] Recursive & downloadable outputs example This goes through each folder and outputs any md files to docx. Github Actions then makes the output directory a zipped download. Developed during problem solving, posted it on https://stackoverflow.com/a/65091856/2257093 --- .github/workflows/downloadable_artifact.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/downloadable_artifact.yml diff --git a/.github/workflows/downloadable_artifact.yml b/.github/workflows/downloadable_artifact.yml new file mode 100644 index 0000000..d029057 --- /dev/null +++ b/.github/workflows/downloadable_artifact.yml @@ -0,0 +1,17 @@ +name: Generate Word docs +on: push + +jobs: + convert_via_pandoc: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: convert md to docx + uses: docker://pandoc/latex:2.9 + with: + entrypoint: /bin/sh + args: -c "mkdir output;for d in */; do mkdir output/$d; done;find ./ -iname '*.md' -type f -exec sh -c 'pandoc ${0} -o output/${0%.md}.docx' {} \;" + - uses: actions/upload-artifact@master + with: + name: output + path: output From a557895d49ebeb4ecb1ff289a055ba71725717e9 Mon Sep 17 00:00:00 2001 From: Steph Locke Date: Thu, 3 Dec 2020 08:48:25 +0000 Subject: [PATCH 2/2] Update .github/workflows/downloadable_artifact.yml Co-authored-by: Caleb Maclennan --- .github/workflows/downloadable_artifact.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/downloadable_artifact.yml b/.github/workflows/downloadable_artifact.yml index d029057..eaae715 100644 --- a/.github/workflows/downloadable_artifact.yml +++ b/.github/workflows/downloadable_artifact.yml @@ -4,13 +4,19 @@ on: push jobs: convert_via_pandoc: runs-on: ubuntu-20.04 + container: + image: docker://pandoc/latex:2.9 + options: --entrypoint=sh steps: - uses: actions/checkout@v2 + - name: prepare output directories + run: | + for d in */; do + mkdir -p output/$d + done - name: convert md to docx - uses: docker://pandoc/latex:2.9 - with: - entrypoint: /bin/sh - args: -c "mkdir output;for d in */; do mkdir output/$d; done;find ./ -iname '*.md' -type f -exec sh -c 'pandoc ${0} -o output/${0%.md}.docx' {} \;" + run: | + find ./ -iname '*.md' -type f -exec sh -c 'pandoc ${0} -o output/${0%.md}.docx' {} \; - uses: actions/upload-artifact@master with: name: output