Fixing syntax bug (darn YML) #56
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: deploy-book | |
# Only run this when the master branch changes | |
on: | |
push: | |
branches: | |
- main | |
# If your git repository has the Jupyter Book within some-subfolder next to | |
# unrelated files, you can make this run only if a file within that specific | |
# folder has been modified. | |
# | |
# paths: | |
# - some-subfolder/** | |
# This job installs dependencies, builds the book, and pushes it to `gh-pages` | |
jobs: | |
compile-jupyterbook: | |
runs-on: ubuntu-22.04 | |
outputs: | |
bookurl: ${{ steps.artifact-upload-step1.outputs.artifact-url }} | |
steps: | |
- uses: actions/checkout@v2 | |
# Install dependencies | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' # caching pip dependencies | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
# Build the book | |
- name: Build the book | |
run: | | |
jupyter-book build . | |
- name: Upload Artifact | |
id: artifact-upload-step1 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-book | |
path: _build/html | |
retention-days: 1 | |
compile-presentation: | |
runs-on: ubuntu-22.04 | |
outputs: | |
presentationurl: ${{ steps.artifact-upload-step2.outputs.artifact-url }} | |
steps: | |
- uses: actions/checkout@v2 | |
# Let's do the Quarto | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.4.0' | |
- name: Install R Dependencies | |
uses: r-lib/actions/setup-renv@v2 | |
with: | |
cache-version: 1 | |
working-directory: presentation | |
- name: Render Quarto Project | |
env: | |
QUARTO_PRINT_STACK: true | |
# uses: quarto-dev/quarto-actions/render@v2 | |
# with: | |
# path: ./presentation | |
run: | | |
cd presentation | |
quarto render index.Rmd | |
- name: Upload Artifact | |
id: artifact-upload-step2 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-presentation | |
path: | | |
presentation/index_files/ | |
presentation/index.html | |
retention-days: 1 | |
create-pdf: | |
needs: compile-presentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download pages artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact-presentation | |
path: _html | |
- name: Check permissions | |
run: | | |
ls -la _html | |
chmod -R a+rwX _html | |
ls -la _html | |
- name: Create PDF | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: astefanutti/decktape | |
options: -v ${{ github.workspace }}/_html:/slides | |
run: | | |
node /decktape/decktape.js --chrome-path /usr/bin/chromium-browser --chrome-arg=--no-sandbox --chrome-arg=--disable-gpu index.html index.pdf | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: artifact-presentation-pdf | |
path: _html/index.pdf | |
deploy-all: | |
runs-on: ubuntu-22.04 | |
needs: | |
- compile-jupyterbook | |
- compile-presentation | |
- create-pdf | |
steps: | |
# Pull down both artifacts | |
- name: Download Book Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: artifact-book | |
- name: Download Pres Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: artifact-presentation | |
- name: Download Pres PDF | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: artifact-pdf | |
- name: Move stuff | |
run: | | |
mv artifact-book website | |
mv artifact-presentation website/presentation | |
mv artifact-pdf/index.pdf website/presentation/presentation.pdf | |
# Prepare the GitHub Pages action | |
- name: prepare GitHub Pages action | |
uses: actions/[email protected] | |
with: | |
path: ./website | |
# publish: | |
# needs: deploy-book | |
# runs-on: ubuntu-latest | |
# steps: | |
# # Push the book's HTML to github-pages | |
# - name: GitHub Pages action | |
# uses: peaceiris/[email protected] | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_dir: ./_build/html | |
publish: | |
needs: deploy-all | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |