Merge pull request #49 from lgeistlinger/devel #49
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
name: CI/CD | |
on: | |
pull_request: | |
branches: [devel] | |
push: | |
branches: [devel] | |
env: | |
cache-version: v1 | |
jobs: | |
# Job to build and check PRs | |
build: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
# Install system dependencies | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev | |
# Set up caching for R packages | |
- name: Cache R packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.R | |
key: ${{ env.cache-version }}-${{ runner.os }}-R | |
restore-keys: | | |
${{ env.cache-version }}-${{ runner.os }}-R- | |
# Add R environment setup step | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
# Install R dependencies | |
- name: Install R dependencies | |
run: Rscript -e 'install.packages(c("evaluate", "rmarkdown", "knitr", "readr", "tidyr", "reactable", "maps", "plotly", "ggplot2", "tidygeocoder", "countrycode"))' | |
# Run Quarto render to check for PRs | |
- name: Render Quarto Project | |
run: quarto render | |
# Job to deploy only when merging to devel | |
deploy: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/devel' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
# Install system dependencies for deployment | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev | |
# Add R environment setup step | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
# Install R dependencies | |
- name: Install R dependencies | |
run: Rscript -e 'install.packages(c("evaluate", "rmarkdown", "knitr", "readr", "tidyr", "reactable", "maps", "plotly", "ggplot2", "tidygeocoder", "countrycode"))' | |
# Add the CNAME file for the custom domain | |
- name: Add CNAME for custom domain | |
run: echo "training.bioconductor.org" > CNAME | |
# Deploy to GitHub Pages | |
- name: Publish to GitHub Pages (and render) | |
uses: quarto-dev/quarto-actions/publish@v2 | |
with: | |
target: gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |