-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a080f2
commit 198701c
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: R Package Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger on pushes to the main branch. You can change this to any branch you like. | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev pandoc | ||
- name: Install R dependencies | ||
run: | | ||
install.packages('devtools') | ||
install.packages('usethis') | ||
install.packages('pkgdown') # for building the site | ||
- name: Build and document R package (conditionally) | ||
if: | | ||
github.event.head_commit.message != 'skip-build' && | ||
(contains(github.event.head_commit.message, "R/") || contains(github.event.head_commit.message, "man/") || contains(github.event.head_commit.message, "DESCRIPTION") || contains(github.event.head_commit.message, "NAMESPACE")) | ||
run: | | ||
R -e "devtools::document()" | ||
R -e "devtools::build()" | ||
- name: Build site | ||
run: | | ||
R -e "usethis::build_site()" | ||
- name: Commit built site and push | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git add docs/ | ||
git commit -m "Update site on commit ${{ github.sha }}" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |