|
| 1 | +name: 📚 Generate eBooks (PDF & EPUB) |
| 2 | + |
| 3 | +on: |
| 4 | + # Runs on pushes to main |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - 'docs/**/*.md' |
| 10 | + - 'docs/**/*.mdx' |
| 11 | + - 'scripts/generate-ebook.sh' |
| 12 | + - '.github/workflows/generate-ebooks.yml' |
| 13 | + |
| 14 | + # Allows manual triggering |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | + # Weekly schedule (every Monday at 00:00 UTC) |
| 18 | + schedule: |
| 19 | + - cron: '0 0 * * 1' |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + |
| 24 | +jobs: |
| 25 | + generate-ebooks: |
| 26 | + name: Generate PDF and EPUB |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: 📥 Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + |
| 35 | + - name: 📦 Install Pandoc |
| 36 | + run: | |
| 37 | + echo "📦 Installing Pandoc and XeLaTeX..." |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get install -y \ |
| 40 | + pandoc \ |
| 41 | + texlive-xetex \ |
| 42 | + texlive-fonts-recommended \ |
| 43 | + texlive-fonts-extra \ |
| 44 | + texlive-latex-extra |
| 45 | +
|
| 46 | + - name: ✅ Verify Pandoc installation |
| 47 | + run: | |
| 48 | + echo "Pandoc version:" |
| 49 | + pandoc --version |
| 50 | + echo "" |
| 51 | + echo "XeLaTeX version:" |
| 52 | + xelatex --version |
| 53 | +
|
| 54 | + - name: 📚 Generate eBooks |
| 55 | + run: | |
| 56 | + chmod +x scripts/generate-ebook.sh |
| 57 | + bash scripts/generate-ebook.sh |
| 58 | +
|
| 59 | + - name: 📊 List generated files |
| 60 | + run: | |
| 61 | + echo "Generated eBooks:" |
| 62 | + ls -lh ebooks/ |
| 63 | +
|
| 64 | + - name: 📤 Upload PDF (Reading Version) as artifact |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: SICP-JS-PT-BR-PDF-Reading |
| 68 | + path: ebooks/SICP-JS-PT-BR.pdf |
| 69 | + retention-days: 90 |
| 70 | + |
| 71 | + - name: 📤 Upload PDF (Print Version) as artifact |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: SICP-JS-PT-BR-PDF-Print |
| 75 | + path: ebooks/SICP-JS-PT-BR-Print.pdf |
| 76 | + retention-days: 90 |
| 77 | + |
| 78 | + - name: 📤 Upload EPUB as artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: SICP-JS-PT-BR-EPUB |
| 82 | + path: ebooks/SICP-JS-PT-BR.epub |
| 83 | + retention-days: 90 |
| 84 | + |
| 85 | + - name: 🏷️ Get current date for release tag |
| 86 | + id: date |
| 87 | + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT |
| 88 | + |
| 89 | + - name: 📦 Create GitHub Release |
| 90 | + uses: softprops/action-gh-release@v1 |
| 91 | + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
| 92 | + with: |
| 93 | + tag_name: ebook-${{ steps.date.outputs.date }} |
| 94 | + name: 📚 eBooks - ${{ steps.date.outputs.date }} |
| 95 | + body: | |
| 96 | + ## 📚 eBook Release - SICP.js PT-BR |
| 97 | +
|
| 98 | + **Data de geração**: ${{ steps.date.outputs.date }} |
| 99 | +
|
| 100 | + ### 📥 Downloads Disponíveis |
| 101 | +
|
| 102 | + - **PDF (Leitura)**: Versão otimizada para leitura em tela com cores e links clicáveis |
| 103 | + - **PDF (Impressão)**: Versão otimizada para impressão em preto e branco |
| 104 | + - **EPUB**: Compatível com e-readers (Kindle, Kobo, Apple Books, etc.) |
| 105 | +
|
| 106 | + ### 📊 Informações |
| 107 | +
|
| 108 | + - Gerado automaticamente a partir dos arquivos markdown |
| 109 | + - Inclui todos os capítulos traduzidos até o momento |
| 110 | + - Tabela de conteúdos interativa |
| 111 | + - Numeração de seções |
| 112 | + - Código com syntax highlighting |
| 113 | +
|
| 114 | + ### 🤝 Como Contribuir |
| 115 | +
|
| 116 | + Encontrou algum erro ou quer contribuir com a tradução? Acesse: |
| 117 | + - [Repositório no GitHub](https://github.com/ibrahimcesar/estrutura-e-interpretacao-de-programas-de-computador-javascript) |
| 118 | + - [Guia de Contribuição](https://github.com/ibrahimcesar/estrutura-e-interpretacao-de-programas-de-computador-javascript/blob/main/CONTRIBUTING.md) |
| 119 | +
|
| 120 | + --- |
| 121 | +
|
| 122 | + 📖 **Leia online**: https://sicpjs.com/pt_BR/ |
| 123 | +
|
| 124 | + 🤖 Gerado automaticamente via GitHub Actions |
| 125 | + files: | |
| 126 | + ebooks/SICP-JS-PT-BR.pdf |
| 127 | + ebooks/SICP-JS-PT-BR-Print.pdf |
| 128 | + ebooks/SICP-JS-PT-BR.epub |
| 129 | + draft: false |
| 130 | + prerelease: false |
| 131 | + env: |
| 132 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 133 | + |
| 134 | + - name: 💬 Add comment to commit (on push) |
| 135 | + if: github.event_name == 'push' |
| 136 | + uses: peter-evans/commit-comment@v3 |
| 137 | + with: |
| 138 | + body: | |
| 139 | + ## 📚 eBooks Gerados com Sucesso! |
| 140 | +
|
| 141 | + Os eBooks foram gerados e estão disponíveis nos artefatos desta execução: |
| 142 | +
|
| 143 | + - 📄 [PDF (Leitura)](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| 144 | + - 🖨️ [PDF (Impressão)](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| 145 | + - 📖 [EPUB](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| 146 | +
|
| 147 | + Os arquivos também foram incluídos em uma release no GitHub. |
0 commit comments