Build rustfava docs #5
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 rustfava docs | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [rustfava-docs-update] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.BOT_APP_ID }} | |
| private-key: ${{ secrets.BOT_PRIVATE_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rustledger/rustfava | |
| path: rustfava-src | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - uses: astral-sh/setup-uv@v4 | |
| - name: Build docs | |
| run: | | |
| cd rustfava-src | |
| touch src/rustfava/static/app.js | |
| uv run --no-dev --group docs mkdocs build -d build/docs | |
| - name: Copy docs | |
| run: | | |
| mkdir -p public/rustfava/docs | |
| cp -r rustfava-src/build/docs/* public/rustfava/docs/ | |
| - name: Create PR | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add public/rustfava/docs | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| BRANCH="rustfava-docs-update-$(date +%Y%m%d-%H%M%S)" | |
| git checkout -b "$BRANCH" | |
| git commit -m "docs: update rustfava documentation" | |
| git push -u origin "$BRANCH" | |
| gh pr create --title "docs: update rustfava documentation" --body "Automated update of rustfava documentation from upstream." --head "$BRANCH" |