Pre CRAN v 0.2.3.9 third submission #31
This file contains 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
# Modified from | |
# - https://github.com/r-lib/actions/tree/master/examples#render-rmarkdown | |
# - https://github.com/gavinsimpson/gratia/blob/master/.github/workflows/readme-renderer.yaml | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- master | |
name: Render Readme | |
jobs: | |
render: | |
name: Render Readme | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2-branch | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Query dependencies | |
run: | | |
install.packages('remotes') | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
- name: Cache R packages | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Install rmarkdown, remotes, and the local package | |
run: | | |
install.packages("remotes") | |
remotes::install_local(".") | |
remotes::install_cran("rmarkdown") | |
remotes::install_cran("devtools") | |
remotes::install_cran("RCurl") | |
remotes::install_cran("kableExtra") | |
shell: Rscript {0} | |
- name: Render README.md using rmarkdown | |
run: Rscript -e 'rmarkdown::render("README.Rmd", output_format = "github_document")' | |
- name: Commit rendered README | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add README.md README.html | |
git commit -m "Re-build README.md" || echo "No changes to commit" | |
git push origin master || echo "No changes to commit" | |
- name: Trigger pkgdown workflow | |
if: success() | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.REPO_GHA_PAT }} | |
repository: ${{ github.repository }} | |
event-type: trigger-pkgdown-workflow | |
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' |