README.adoc in asciidoctor-reducer-1.0.2 vs README.adoc in asciidoctor-reducer-1.0.3

- old
+ new

@@ -1,8 +1,8 @@ = {project-name} Dan Allen <https://github.com/mojavelinux[@mojavelinux]> -v1.0.2, 2022-05-09 +v1.0.3, 2022-09-22 :idprefix: :idseparator: - ifndef::env-github[:icons: font] ifdef::env-github[] :caution-caption: :fire: @@ -257,9 +257,48 @@ ---- //# includes=chapters/chapter-a,chapters/chapter-b ---- When a document that contains the magic comment is converted, the include mapper reads the comma-separated paths in the value and loads them into the includes table of the document catalog. + +== Reduce files in a GitHub repository + +It's well known that the AsciiDoc preview on GitHub does not support the include directive. +With the help of GitHub Actions, Asciidoctor Reducer is ready-made to solve this problem. + +In order to set up this automated process, you need to first rename the source file to make room for the reduced file. +Let's call the source file [.path]_README-source.adoc_ and the reduced file [.path]_README.adoc_. + +Next, create a GitHub Actions workflow file named [.path]_.github/workflows/reduce-readme.yml_ and populate it with the following contents: + +..github/workflows/reduce-readme.yml +[,yaml] +---- +name: Reduce README +on: + push: + paths: + - README-source.adoc + branches: ['**'] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Asciidoctor Reducer + run: sudo gem install asciidoctor-reducer + - name: Reduce README + run: asciidoctor-reducer -o README.adoc README-source.adoc + - name: Commit and Push README + uses: EndBug/add-and-commit@v9 + with: + add: README.adoc +---- + +Now, each time you modify, commit, and push the [.path]_README-source.adoc_ file, the GitHub Action workflow will run, reduce that file, and push the reduced file back to the repository as [.path]_README.adoc_. + +If you want to trigger the workflow on changes to other files as well, add those paths or path patterns to the value of the `paths` key. == Development Follow the instructions below to learn how to help develop the project or test-drive the development version.