Skip to content

Commit

Permalink
update posting mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
nhejazi committed Nov 14, 2024
1 parent 2c1dd55 commit 9d43568
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- master

name: booklet

permissions:
contents: write
jobs:
bookdown:
name: build-bookdown
Expand Down Expand Up @@ -50,39 +51,14 @@ jobs:
Rscript -e 'bookdown::clean_book(TRUE)'
Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.event_name != 'pull_request'
with:
branch: gh-pages
folder: _book/

- uses: actions/upload-artifact@v4
with:
name: _book
path: _book/

# Need to first create an empty gh-pages branch
# see https://pkgdown.r-lib.org/reference/deploy_site_github.html
# and also add secrets for a GH_PAT and EMAIL to the repository
# gh-action from https://github.com/Cecilapp/GitHub-Pages-deploy
checkout-and-deploy:
runs-on: ubuntu-latest
needs: bookdown
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4
with:
# Artifact name
name: _book # optional
# Destination path
path: _book # optional

- name: Abbreviate Git SHA
run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV

- name: Deploy to GitHub Pages
uses: Cecilapp/GitHub-Pages-deploy@v3
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
email: ${{ secrets.EMAIL }} # must be a GitHub-verified email
build_dir: _book/ # "_site/" by default
commit_message: Update book via ${{ env.GITHUB_SHA_SHORT }}
2 changes: 1 addition & 1 deletion _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ rmd_files: [
"08-tmle3.Rmd",
"09-tmle3mopttx.Rmd",
"10-tmle3shift.Rmd",
"11-tmle3mediate.Rmd",
# "11-tmle3mediate.Rmd",
"references.Rmd"
]

0 comments on commit 9d43568

Please sign in to comment.