feat: paal-53 add github action workflow #2
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
| # .github/workflows/deploy-docs.yml | |
| name: Build and Deploy Antora Docs | |
| # This workflow runs on any push to the 'main' branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allows manual triggering from GitHub Actions UI | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to push to the gh-pages branch | |
| steps: | |
| # 1. Checks out the playbook repository's source code | |
| - name: Checkout playbook source | |
| uses: actions/checkout@v4 | |
| # 2. Sets up the Node.js environment needed for Antora | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.3.0' # Use Node.js version 24.3.0 for consistency | |
| cache: 'npm' # Cache npm dependencies for faster builds | |
| # 3. Installs Antora's command-line tools | |
| - name: Install Antora | |
| run: npm install -g @antora/cli @antora/site-generator | |
| # 4. Runs the Antora command to generate the site into ./build/site | |
| - name: Generate Site | |
| run: antora antora-playbook.yml | |
| # 5. Deploys the generated site to the 'gh-pages' branch | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} # Built-in token with necessary permissions | |
| branch: gh-pages # The branch to deploy to | |
| publish_dir: build/site # The folder containing the built site |