@@ -18,22 +18,36 @@ jobs:
1818 build_and_deploy :
1919 runs-on : ubuntu-latest
2020 steps :
21- # 1. Check out the repo
21+ # 1. Check out the repo (with fetch-depth 2 to detect changes)
2222 - name : Checkout
2323 uses : actions/checkout@v4
24+ with :
25+ fetch-depth : 2
26+
27+ # 2. Detect if BoosStefanskiQMD folder has changes
28+ - name : Check for BoosStefanskiQMD changes
29+ id : check_boosstefanski
30+ run : |
31+ if git diff --name-only HEAD~1 HEAD -- 'documents/BoosStefanskiQMD/' | grep -q .; then
32+ echo "changed=true" >> $GITHUB_OUTPUT
33+ else
34+ echo "changed=false" >> $GITHUB_OUTPUT
35+ fi
2436
25- # 2 . Install Quarto
37+ # 3 . Install Quarto
2638 - name : Setup Quarto
2739 uses : quarto-dev/quarto-actions/setup@v2
2840
29- # 3 . Install R
41+ # 4 . Install R (only if BoosStefanskiQMD changed)
3042 - name : Setup R
43+ if : steps.check_boosstefanski.outputs.changed == 'true'
3144 uses : r-lib/actions/setup-r@v2
3245 with :
3346 r-version : ' 4.4.1'
3447
35- # 4 . Install R package dependencies
48+ # 5 . Install R package dependencies (only if BoosStefanskiQMD changed)
3649 - name : Install R packages
50+ if : steps.check_boosstefanski.outputs.changed == 'true'
3751 run : |
3852 # Install system dependencies commonly needed by R packages
3953 sudo apt-get update
4660 Rscript -e 'install.packages(c("knitr", "rmarkdown", "tidyverse", "ggplot2", "kableExtra", "numDeriv"), repos = "https://cloud.r-project.org")'
4761 fi
4862
49- # 5 . Render the Boos & Stefanski Quarto project to HTML
63+ # 6 . Render the Boos & Stefanski Quarto project to HTML (only if BoosStefanskiQMD changed)
5064 - name : Render Boos and Stefanski QMD
65+ if : steps.check_boosstefanski.outputs.changed == 'true'
5166 run : |
5267 cd documents/BoosStefanskiQMD
5368 quarto render --output-dir _output
@@ -57,24 +72,24 @@ jobs:
5772 mkdir -p documents/BoosStefanski
5873 cp -r documents/BoosStefanskiQMD/_output/* documents/BoosStefanski/
5974
60- # 6 . Setup Ruby and install gems (for jekyll-scholar, etc.)
75+ # 7 . Setup Ruby and install gems (for jekyll-scholar, etc.)
6176 - name : Setup Ruby
6277 uses : ruby/setup-ruby@v1
6378 with :
6479 ruby-version : ' 3.2'
6580 bundler-cache : true
6681
67- # 7 . Configure GitHub Pages
82+ # 8 . Configure GitHub Pages
6883 - name : Configure Pages
6984 uses : actions/configure-pages@v5
7085
71- # 8 . Build the Jekyll site
86+ # 9 . Build the Jekyll site
7287 - name : Build with Jekyll
7388 run : bundle exec jekyll build --baseurl ""
7489 env :
7590 JEKYLL_ENV : production
7691
77- # 9 . Upload the built site as a Pages artifact
92+ # 10 . Upload the built site as a Pages artifact
7893 - name : Upload artifact
7994 uses : actions/upload-pages-artifact@v3
8095
0 commit comments