Build EPUB, Word, and BRF #7
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: Start DAISY Pipeline 2 service | |
| run: | | |
| PIPELINE_DIR=pipeline2/daisy-pipeline | |
| $PIPELINE_DIR/bin/pipeline2 & | |
| echo "Waiting for Pipeline service to start..." | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:8181/ws/alive > /dev/null 2>&1; then | |
| echo "Pipeline service is up" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| - name: Convert EPUB to DAISY 2.02 (text-only talking book) | |
| continue-on-error: true | |
| run: | | |
| mkdir -p epub/daisy | |
| pipeline2/daisy-pipeline/cli/dp2 epub3-to-daisy202 \ | |
| --source epub/git-going-with-github.epub \ | |
| --output epub/daisy/ | |
| - name: Convert EPUB to BRF (Braille) | |
| continue-on-error: true | |
| run: | | |
| mkdir -p epub/brf | |
| pipeline2/daisy-pipeline/cli/dp2 epub3-to-pef \ | |
| --source epub/git-going-with-github.epub \ | |
| --output epub/brf/ \ | |
| --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/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 |