File tree Expand file tree Collapse file tree 3 files changed +131
-93
lines changed
Expand file tree Collapse file tree 3 files changed +131
-93
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Build and Deploy Website
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' rmd/**'
9+ - ' build-site.R'
10+ - ' .github/workflows/build-site.yml'
11+ pull_request :
12+ branches :
13+ - main
14+ paths :
15+ - ' rmd/**'
16+ - ' build-site.R'
17+ workflow_dispatch :
18+
19+ jobs :
20+ build :
21+ runs-on : ubuntu-latest
22+
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v3
26+
27+ - name : Setup R
28+ uses : r-lib/actions/setup-r@v2
29+ with :
30+ r-version : ' 4.3.0'
31+ use-public-rspm : true
32+
33+ - name : Cache apt packages
34+ uses : actions/cache@v3
35+ with :
36+ path : /var/cache/apt/archives
37+ key : ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/build-site.yml') }}
38+ restore-keys : |
39+ ${{ runner.os }}-apt-
40+
41+ - name : Install system dependencies
42+ run : |
43+ sudo apt-get update
44+ sudo apt-get install -y \
45+ libcurl4-openssl-dev \
46+ libssl-dev \
47+ libxml2-dev \
48+ pandoc
49+
50+ - name : Cache R packages
51+ uses : actions/cache@v3
52+ with :
53+ path : ${{ env.R_LIBS_USER }}
54+ key : ${{ runner.os }}-r-${{ hashFiles('**/DESCRIPTION') }}-${{ hashFiles('.github/workflows/build-site.yml') }}
55+ restore-keys : |
56+ ${{ runner.os }}-r-
57+
58+ - name : Install R packages
59+ run : |
60+ Rscript -e 'install.packages("rmarkdown", repos="https://cloud.r-project.org")'
61+
62+ - name : Cache Pandoc
63+ uses : actions/cache@v3
64+ with :
65+ path : ~/.cache/pandoc
66+ key : ${{ runner.os }}-pandoc-${{ hashFiles('rmd/**') }}
67+ restore-keys : |
68+ ${{ runner.os }}-pandoc-
69+
70+ - name : Build site
71+ run : |
72+ Rscript build-site.R
73+
74+ - name : Create .nojekyll file
75+ run : touch docs/.nojekyll
76+
77+ - name : Commit and push if changes
78+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
79+ run : |
80+ git config --local user.email "action@github.com"
81+ git config --local user.name "GitHub Action"
82+ git add docs/
83+ git diff --quiet && git diff --staged --quiet || (git commit -m "Auto-build website [skip ci]" && git push)
Original file line number Diff line number Diff line change 1+ # Simple workflow for deploying static content to GitHub Pages
2+ name : Deploy static content to Pages
3+
4+ on :
5+ # Runs after the build-site workflow completes successfully
6+ workflow_run :
7+ workflows : ["Build and Deploy Website"]
8+ types :
9+ - completed
10+ branches : ["main"]
11+
12+ # Allows you to run this workflow manually from the Actions tab
13+ workflow_dispatch :
14+
15+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+ permissions :
17+ contents : read
18+ pages : write
19+ id-token : write
20+
21+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+ concurrency :
24+ group : " pages"
25+ cancel-in-progress : false
26+
27+ jobs :
28+ # Single deploy job since we're just deploying
29+ deploy :
30+ # Only run if the build workflow succeeded
31+ if : ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
32+ environment :
33+ name : github-pages
34+ url : ${{ steps.deployment.outputs.page_url }}
35+ runs-on : ubuntu-latest
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+ - name : Setup Pages
40+ uses : actions/configure-pages@v5
41+ - name : Upload artifact
42+ uses : actions/upload-pages-artifact@v3
43+ with :
44+ # Upload docs folder (generated HTML)
45+ path : ' docs'
46+ - name : Deploy to GitHub Pages
47+ id : deployment
48+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments