Update _config.yml #230
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: Pull changes and deploy | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push events but only for the main branch | |
push: | |
branches: [ main ] | |
# Allows running this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment. New triggered workflows will interrupt on other concurrent ones | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
# This job updates the repos dependency on upstream LCA-mini. | |
jobs: | |
update-submodule: | |
name: Update submodules, build, and deploy | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout this repo | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
submodules: 'recursive' | |
# Update upstream dependencies to latest commit | |
- name: Update submodules | |
run: | | |
git submodule update --init --recursive | |
git submodule update --recursive --remote | |
# A user is needed por pushing the update. If no changes are detected, nothing gets pushed. | |
- name: Push | |
run: | | |
git config user.name "Jose Fernando Barrera De Plaza" | |
git config user.email [email protected] | |
git add . | |
git diff --staged --quiet || (git commit -m "Updated submodules. [skip ci]" && git push) | |
# Install python and book build dependencies | |
- name: Set up Micromamba | |
uses: mamba-org/provision-with-micromamba@main | |
with: | |
environment-file: ./PAD-book/build-environment.yml | |
environment-name: JBookEnv | |
cache-env: true | |
# Deletes all notebooks that are not of type TUTORIAL and are not of type LECTURA | |
# Removes all markdown files that are not the book intro | |
- name: Remove unused notebooks and md files for book build | |
run: | | |
find . -name '*.ipynb' ! -name 'TUTORIAL*' ! -name 'LECTURA*' -type f -delete | |
find . -name '*.md' ! -name 'intro.md' -type f -delete | |
# Build the book, requires bash to initialize autorun scripts for mamba, hence bash -l {0} | |
- name: Build the book | |
shell: bash -l {0} | |
run: | | |
jupyter-book build --all ./PAD-book | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload repo subdirectory | |
path: './PAD-book/_build/html/' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |