Make JSON of tutorial registry #713
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: Make JSON of tutorial registry | |
on: | |
push: | |
branches: [main] | |
schedule: | |
- cron: "0 2 * * *" | |
pull_request: | |
branches: ["*"] | |
paths: | |
- tutorial-registry/** | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
mkjson: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
filter: blob:none | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" # caching pip dependencies | |
- name: Install dependencies for validation script | |
run: pip install .[registry] | |
- name: Execute validation script and create output directory | |
run: | | |
./tutorial-registry/validate.py --outdir=build | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "build" | |
deploy: | |
runs-on: ubuntu-latest | |
needs: mkjson | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }}/tutorials.json | |
if: github.ref == 'refs/heads/main' && github.event_name != 'schedule' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
- name: Trigger website build | |
run: | | |
curl -XPOST \ | |
-u "scverse-bot:${{ secrets.BOT_GH_TOKEN }}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-H "Content-Type: application/json" \ | |
https://api.github.com/repos/scverse/scverse.github.io/actions/workflows/gh-pages.yml/dispatches \ | |
--data '{"ref": "main"}' |