|
| 1 | +name: MyST GitHub Pages Deploy |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [myst_build] |
| 5 | +env: |
| 6 | + BASE_URL: /${{ github.event.repository.name }} |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | +concurrency: |
| 13 | + group: 'pages' |
| 14 | + cancel-in-progress: false |
| 15 | +jobs: |
| 16 | + deploy: |
| 17 | + environment: |
| 18 | + name: github-pages |
| 19 | + url: ${{ steps.deployment.outputs.page_url }} |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: Setup Pages |
| 24 | + uses: actions/configure-pages@v3 |
| 25 | + - name: Cache Notebook Execution |
| 26 | + uses: actions/cache@v3 |
| 27 | + id: cache-execution |
| 28 | + with: |
| 29 | + path: ./lectures/_build/execute |
| 30 | + key: ${{ runner.os }}-execute-cache-${{ hashFiles('lectures/**/*.md') }} |
| 31 | + - uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: 18.x |
| 34 | + - name: Install Python |
| 35 | + if: steps.cache-execution.outputs.cache-hit != 'true' |
| 36 | + uses: actions/setup-python@v5 |
| 37 | + with: |
| 38 | + python-version: '3.12' |
| 39 | + cache: 'pip' |
| 40 | + cache-dependency-path: 'myst_requirements.txt' |
| 41 | + - name: Install execution requirements for ipykernel and jupyter-server |
| 42 | + if: steps.cache-execution.outputs.cache-hit != 'true' |
| 43 | + run: python -m pip install -r myst_requirements.txt |
| 44 | + shell: bash |
| 45 | + - name: Install MyST Markdown |
| 46 | + run: npm install -g mystmd |
| 47 | + - name: Build HTML Assets |
| 48 | + working-directory: ./lectures |
| 49 | + run: myst build --html --execute |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-pages-artifact@v3 |
| 52 | + with: |
| 53 | + path: './lectures/_build/html' |
| 54 | + - name: Deploy to GitHub Pages |
| 55 | + id: deployment |
| 56 | + uses: actions/deploy-pages@v4 |
0 commit comments