First commit. #1
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: Generate Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/**" | |
| - ".github/workflows/docs-pages.yaml" | |
| - "src/package_name/**" # rebuild if API docs change | |
| permissions: | |
| contents: write # needed to push to gh-pages | |
| concurrency: | |
| group: docs-pages | |
| cancel-in-progress: true | |
| jobs: | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: "4.5" | |
| - name: Install rv | |
| run: curl -sSL https://raw.githubusercontent.com/A2-ai/rv/refs/heads/main/scripts/install.sh | sh | |
| - name: Sync project | |
| run: rv sync | |
| - name: Run Quartrify | |
| run: Rscript -e "quartify::rtoqmd_dir('src/package_name/', render = TRUE, output_html_dir = '../../docs/html', exclude_pattern='__tests__')" | |
| - name: Move generated .qmd files to docs/ #quartrify generates .qmd files next to the source .R files. it would be better if they are in docs. | |
| run: | | |
| find src/package_name/ -name "*.qmd" -exec mv {} docs/ \; | |
| mv src/package_name/_quarto.yml docs/ | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/html | |
| # - name: Create Pull Request with generated docs | |
| # uses: peter-evans/create-pull-request@v5 | |
| # with: | |
| # token: ${{ secrets.GITHUB_TOKEN }} | |
| # commit-message: "chore(docs): add generated documentation" | |
| # branch: "docs/generated-${{ github.run_id }}" | |
| # title: "Add generated documentation" | |
| # body: "This PR adds generated .qmd and .html documentation into docs/ and docs/html/." | |
| # base: main | |
| # labels: | | |
| # autogenerated | |
| # documentation |