Build EPUB, Word, and BRF #4
Workflow file for this run
This file contains hidden or 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
| name: Build EPUB, Word, DAISY, and BRF | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| - 'epub/metadata.yaml' | |
| - 'epub/epub.css' | |
| - 'epub/pdf.css' | |
| - 'scripts/build-epub.js' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Pandoc | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y pandoc | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build EPUB and Word | |
| run: node scripts/build-epub.js | |
| - name: Install DAISY Pipeline 2 CLI | |
| run: | | |
| curl -sL https://github.com/daisy/pipeline-assembly/releases/download/v1.15.3/pipeline2-1.15.3_linux.zip -o pipeline2.zip | |
| unzip -q pipeline2.zip -d pipeline2 | |
| ls pipeline2/ | |
| - name: Convert EPUB to DAISY (talking book) | |
| run: | | |
| PIPELINE_DIR=$(find pipeline2 -name "dp2" -type f | head -1 | xargs dirname) | |
| echo "Pipeline CLI at: $PIPELINE_DIR" | |
| mkdir -p epub/daisy | |
| $PIPELINE_DIR/dp2 epub3-to-daisy3 \ | |
| --epub epub/git-going-with-github.epub \ | |
| --output epub/daisy/ | |
| - name: Convert EPUB to BRF (Braille) | |
| run: | | |
| PIPELINE_DIR=$(find pipeline2 -name "dp2" -type f | head -1 | xargs dirname) | |
| $PIPELINE_DIR/dp2 epub3-to-pef \ | |
| --epub epub/git-going-with-github.epub \ | |
| --output epub/ \ | |
| --output-format brf | |
| - name: Upload EPUB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: git-going-with-github-epub | |
| path: epub/git-going-with-github.epub | |
| retention-days: 90 | |
| - name: Upload Word artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: git-going-with-github-word | |
| path: epub/git-going-with-github.docx | |
| retention-days: 90 | |
| - name: Upload DAISY artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: git-going-with-github-daisy | |
| path: epub/daisy/ | |
| retention-days: 90 | |
| - name: Upload BRF artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: git-going-with-github-brf | |
| path: epub/git-going-with-github.brf | |
| retention-days: 90 | |
| - name: Commit outputs to repository | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add epub/git-going-with-github.epub epub/git-going-with-github.docx | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git commit -m "chore: rebuild EPUB and Word from latest docs" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |