4
4
workflow_call :
5
5
inputs :
6
6
environment_name :
7
- description : ' Name of conda environment to activate'
7
+ description : ' Name of conda environment to activate (NO LONGER USED) '
8
8
required : false
9
9
default : ' cookbook-dev'
10
10
type : string
16
16
path_to_notebooks :
17
17
description : ' Location of the JupyterBook source relative to repo root'
18
18
required : false
19
- default : ' ./ '
19
+ default : ' .'
20
20
type : string
21
- use_cached_environment :
22
- description : ' Flag for whether we should attempt to retrieve a previously cached environment.'
23
- required : false
24
- default : ' true'
25
- type : string # had a lot of trouble with boolean types, see https://github.com/actions/runner/issues/1483${{ github.repository }}
26
21
artifact_name :
27
22
description : ' The name to assign to the built book artifact.'
28
23
required : false
58
53
required : false
59
54
default : success
60
55
type : string
61
-
56
+ base_url :
57
+ description : ' Determines where the website is served from, including CSS & JS assets (needed for MyST)'
58
+ required : false
59
+ default : ' /${{ github.event.repository.name }}'
60
+ type : string
62
61
63
62
secrets :
64
63
ARM_USERNAME :
80
79
description : ' NASA Earthdata API Password'
81
80
required : false
82
81
82
+ env :
83
+ # the BASE_URL environment variable needs to be set if building with myst
84
+ BASE_URL : ${{ inputs.base_url }}
85
+
83
86
jobs :
84
87
build :
85
88
runs-on : ubuntu-latest
86
89
defaults :
87
90
run :
88
- shell : bash -l {0}
91
+ shell : bash -leo pipefail {0}
89
92
steps :
90
93
- name : Checkout the code from the repo
91
94
if : inputs.build_from_code_artifact == 'false'
@@ -108,10 +111,11 @@ jobs:
108
111
run : |
109
112
unzip pr_code.zip
110
113
rm -f pr_code.zip
111
-
112
- # - name: Fetch Repo Name
113
- # id: repo-name
114
- # run: echo "value=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT # just the repo name, not owner
114
+
115
+ - name : Setup Node.js
116
+ uses : actions/setup-node@v4
117
+ with :
118
+ node-version : 18.x
115
119
116
120
- name : Get GitHub environment variables
117
121
id : get-env
@@ -150,26 +154,11 @@ jobs:
150
154
run : |
151
155
echo '(DEBUG) The value of steps.env_change.outputs.any_changed is:'
152
156
echo ${{ steps.env_change.outputs.any_changed }}
153
-
154
- - name : Setup Miniforge
155
- uses : conda-incubator/setup-miniconda@v3
156
- with :
157
- miniforge-version : latest
158
- python-version : " 3.10" # binderbot is failing with python 3.11
159
- activate-environment : ${{ inputs.environment_name }}
160
-
161
- - name : Set cache date
162
- if : inputs.use_cached_environment == 'true'
163
- run : echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
164
-
165
- - uses : actions/cache@v4
166
- if : inputs.use_cached_environment == 'true'
157
+
158
+ - name : Setup environment with micromamba
159
+ uses : mamba-org/setup-micromamba@v2
167
160
with :
168
- path : /usr/share/miniconda3/envs/${{ inputs.environment_name }}
169
- # This should create a key that looks like 'linux-64-conda-environment.yml-[HASH]-_config.yml-[HASH]-DATE'
170
- # Logic inspired by https://dev.to/epassaro/caching-anaconda-environments-on-github-actions-2d08
171
- key : ${{ format('linux-64-conda-{0}-{1}-{2}-{3}-{4}', inputs.environment_file, hashFiles(format('{0}', inputs.environment_file)), '_config.yml', hashFiles(format('{0}', '_config.yml')), env.DATE )}}
172
- id : cache
161
+ environment-file : ${{ inputs.environment_file }}
173
162
174
163
- name : Create book build environment
175
164
if : |
@@ -182,16 +171,6 @@ jobs:
182
171
pip install git+https://github.com/pangeo-gallery/binderbot.git
183
172
conda list
184
173
185
- - name : Update execution environment
186
- if : |
187
- (inputs.use_cached_environment != 'true'
188
- || steps.cache.outputs.cache-hit != 'true'
189
- || steps.env_change.outputs.any_changed == 'true')
190
- && steps.parse_config.outputs.execute_notebooks != 'binder'
191
- run : |
192
- conda env update -n ${{ inputs.environment_name }} -f ${{ inputs.environment_file }}
193
- conda list
194
-
195
174
- name : Get paths to notebook files
196
175
if : |
197
176
steps.parse_config.outputs.execute_notebooks == 'binder'
@@ -258,6 +237,7 @@ jobs:
258
237
- name : Build the book
259
238
# Assumption is that if execute_notebooks != 'binder' then the _config.yml file must be set to execute notebooks during build
260
239
env :
240
+ # BASE_URL: /${{ github.repository }}
261
241
ARM_USERNAME : ${{ secrets.ARM_USERNAME }}
262
242
ARM_PASSWORD : ${{ secrets.ARM_PASSWORD }}
263
243
AQS_USERNAME : ${{ secrets.AQS_USERNAME }}
@@ -276,7 +256,7 @@ jobs:
276
256
if [ -f book.zip ]; then
277
257
rm -rf book.zip
278
258
fi
279
- zip -r book.zip ${{ inputs.path_to_notebooks }}/ ${{ inputs.output_path }}
259
+ zip -r book.zip ${{ inputs.path_to_notebooks }}/${{ inputs.output_path }}
280
260
281
261
- name : Upload zipped book artifact
282
262
uses : actions/upload-artifact@v4
0 commit comments