Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
change deploy mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
nhejazi committed Nov 13, 2024
1 parent 3f4e1ba commit ceb8967
Showing 1 changed file with 9 additions and 33 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 }}

0 comments on commit ceb8967

Please sign in to comment.