Skip to content

Commit

Permalink
Create build-and-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
benyamindsmith authored Oct 30, 2024
1 parent 3a080f2 commit 198701c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-and-deploy.yml
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 }}

0 comments on commit 198701c

Please sign in to comment.