Merge pull request #40 from herm/sunlu_jayo #159
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install pipx | |
run: | | |
sudo apt update | |
sudo apt install pipx | |
pipx ensurepath | |
- name: Install jsonschema | |
run: pipx install check-jsonschema | |
- name: Validate Materials | |
run: check-jsonschema --schemafile materials.schema.json materials.json | |
- name: Validate Filaments | |
run: check-jsonschema --schemafile filaments.schema.json filaments/* | |
compile: | |
runs-on: ubuntu-latest | |
needs: [validate] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Compile filaments | |
run: python3 scripts/compile_filaments.py | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: filaments | |
path: filaments.json | |
if-no-files-found: error | |
# Single deploy job since we're just deploying | |
deploy: | |
if: ${{ github.event_name != 'pull_request' }} | |
needs: [compile] | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Restore artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: filaments | |
path: public | |
- name: Copy remaining data | |
run: | | |
cp materials.json public/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: public/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |