Cleanup old audio transcript #42
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: Publish to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build: | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| permissions: | |
| actions: write | |
| checks: write | |
| contents: write | |
| deployments: write | |
| issues: write | |
| packages: write | |
| pull-requests: write | |
| repository-projects: write | |
| security-events: write | |
| statuses: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| bundler-cache: true | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Generate PDF | |
| run: | | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| npx antora --extension @antora/pdf-extension antora-playbook.yml | |
| PDF_FILE=$(find build/assembler -name '*.pdf' -type f -size +0 2>/dev/null | head -1) | |
| if [ -z "$PDF_FILE" ]; then | |
| PDF_FILE=$(find build/site -path '*/_exports/*.pdf' -type f -size +0 2>/dev/null | head -1) | |
| fi | |
| if [ -z "$PDF_FILE" ]; then | |
| echo "::error::No PDF was generated by the Antora PDF extension" | |
| exit 1 | |
| fi | |
| mkdir -p modules/appendix/attachments | |
| cp "$PDF_FILE" "modules/appendix/attachments/${REPO_NAME}.pdf" | |
| echo "PDF generated: modules/appendix/attachments/${REPO_NAME}.pdf" | |
| - name: Generate Site | |
| run: npm run build | |
| - name: Publish to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: build/site | |
| keep_files: true | |
| - name: Commit PDF to repository | |
| run: | | |
| git add modules/appendix/attachments/ | |
| if git diff --staged --quiet; then | |
| echo "No PDF changes to commit" | |
| else | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git commit -m "docs: update generated course PDF [skip ci]" | |
| git push | |
| fi |