-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (128 loc) · 3.76 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
deploy-book:
runs-on: ubuntu-22.04
needs:
- compile-jupyterbook
- compile-presentation
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: Move stuff
run: |
mv artifact-book website
mv artifact-presentation website/presentation
# 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-book
# 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