Automate your Ibis eBook build process with this GitHub Action + Workflow




Introduction

The ibis-build-action action is a GitHub Action to automatically run your ibis builds on push events to your main branch.

Ibis is an open-source PHP tool that lets you write eBooks in Markdown. It was created by Mohamed Said who used it to generate his own eBook that he was writing at the time!

Ibis has allowed me to create multiple eBooks already. However not everyone has PHP and Composer installed on their laptops, so people who contribute to your eBook project might not be able to export the PDF of your eBook after their changes.

This is why I decided to create a GitHub Action that would let you automatically generate your Ibis builds directly on GitHub, without having PHP installed on your laptop.



Submission Category:

Maintainer Must-Haves



My Workflow

In order to automatically build your Ibis PDF files, create a directory called .github/workflows/ and add a fill called ibis.yml with the following content:

name: Ibis eBook Generation
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]
      with:
        fetch-depth: '0'
    - name: Build Ibis Export Files
      uses: bobbyiliev/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        IBIS_PATH: './'
        IBIS_BRANCH: 'main'
        EMAIL: '[email protected]'
        COMMIT_MESSAGE: 'Updated Ibis Exorted Files'



Environment Variables

This is the list of the environment variables that you need to keep in mind:



Overview

You can find the ibis-build-action GitHub Action repository here:

GitHub logo

bobbyiliev
/
ibis-build-action

GitHub Action to run ibis builds on merge

ibis-build-action

A GitHub Action to automatically run ibis builds on merge to main.

Ibis GitHub Action

Ibis

Ibis is a PHP tool that lets you write eBooks in Markdown.

Usage

In order to automatically build your Ibis PDF files, create a directory called .github/workflows/ and add a fill called ibis.yml with the following content:

name: Ibis eBook Generation
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]
      with:
        fetch-depth: '0'
    - name: Build Ibis Export Files
      uses: bobbyiliev/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        IBIS_PATH: './'
        IBIS_BRANCH: 'main'
        EMAIL: '[email protected]'
        COMMIT_MESSAGE: 'Updated Ibis Exorted Files'

Environment Variables

  • GITHUB_TOKEN: Required for permission to tag the repo. You can leave it as it is.
  • IBIS_PATH: The path to the Ibis…

The ibis-build-action GitHub Action does the following things once added to your repository.

Every time you push to main or merge a PR to main this workflow takes palce:

ibis-build-action screenshot of completed action

This will provide you with your eBook PDF file generated and stored in your repository’s content folder.



Ebook Projects using the ibis-build-action GitHub action:



Alternative approach

As brought up to my attention recently by Roberto B, in case that you need more flexibility about managing the PDF, rather than using the ibis-build-action GitHub action, you can produce an artifact instead.

Here is an example GitHub workflow provided by Robert which would do the same build but store the PDF as an artifact:

Ibis artifact workflow



Conclusion

Ibis is a great tool and in case that you are planning to write an eBook make sure to give it a try!

By using the ibis-build-action GitHub Action, you can automate your eBook PDF generation on each push to a specific branch and always have an up-to date export of your eBook!

If you like this, make sure to follow me on Twitter:

@bobbyiliev

I hope that this was helpful!

Source: DEV Community

November 17, 2021
Category : News
Tags: actionshackathon21 | books | Git | github

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.