Added badges to README #69
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: Run Notebooks and Save Outputs | |
on: | |
push: | |
branches: | |
- main # Trigger the action on the main branch | |
- mb/jb | |
permissions: | |
id-token: write | |
pages: write | |
jobs: | |
# Run the notebooks | |
run-notebooks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Clear GitHub Action Caches | |
run: | | |
echo "Clearing caches..." | |
sudo rm -rf ~/.cache/pip | |
sudo rm -rf executed_notebooks | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Install SCT | |
run: | | |
git clone --depth 1 https://github.com/spinalcordtoolbox/spinalcordtoolbox.git | |
yes | spinalcordtoolbox/install_sct | |
# NB: install_sct edits ~/.bashrc, but those environment changes don't get passed to subsequent steps in GH Actions. | |
# So, we filter through the .bashrc and pass the values to $GITHUB_ENV and $GITHUB_PATH. | |
# Relevant documentation: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files | |
# This workaround should be replaced by https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3198#discussion_r568225392 | |
cat ~/.bashrc | grep "export SCT_DIR" | cut -d " " -f 2 >> $GITHUB_ENV | |
cat ~/.bashrc | grep "export PATH" | grep -o "/.*" | cut -d ':' -f 1 >> $GITHUB_PATH | |
- name: Verify SCT installation | |
run: | | |
# Make sure SCT can be called from within the environment | |
sct_check_dependencies | |
- name: Run Jupyter Notebooks and build book | |
continue-on-error: true # Allow workflow to continue even if notebook execution fails | |
run: jupyter-book build . | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: './_build/html' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |