Merge pull request #9 from DiogoRibeiro7/dependabot/github_actions/ac… #19
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
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ['*'] | |
| name: pkgdown | |
| jobs: | |
| pkgdown: | |
| runs-on: ubuntu-latest | |
| # Only restrict concurrency for non-PR jobs | |
| concurrency: | |
| group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| BLOG_REPO: DiogoRibeiro7/DiogoRibeiro7.github.io | |
| BLOG_DEST: packages/myrpackage | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: | | |
| any::roxygen2 | |
| any::pkgdown | |
| local::. | |
| needs: website | |
| - name: Document (generate NAMESPACE & man/) | |
| run: roxygen2::roxygenise() | |
| shell: Rscript {0} | |
| # You can use build_site_github_pages(); build_site() is fine since we copy to blog | |
| - name: Build site | |
| run: pkgdown::build_site(preview = FALSE) | |
| shell: Rscript {0} | |
| - name: Checkout blog repository | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ env.BLOG_REPO }} | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # PAT with repo write access to the blog repo | |
| path: blog-repo | |
| - name: Copy package docs to blog (includes dotfiles, cleans removed files) | |
| run: | | |
| mkdir -p "blog-repo/${BLOG_DEST}" | |
| rsync -av --delete docs/ "blog-repo/${BLOG_DEST}/" | |
| # short listing for debugging | |
| ls -la "blog-repo/${BLOG_DEST}" | sed -n '1,80p' | |
| # No index/nav editing here since your blog already has the page and navigation. | |
| - name: Commit and push changes | |
| run: | | |
| cd blog-repo | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add . | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update unconfoundedr documentation" | |
| git push | |
| fi | |