Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .github/workflows/deploy.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/nightly-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: nightly-build

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # Daily “At 00:00”

jobs:
build:
if: ${{ github.repository_owner == 'ProjectPythia' }}
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main

deploy:
needs: build
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main

link-check:
if: ${{ github.repository_owner == 'ProjectPythia' }}
uses: ProjectPythia/cookbook-actions/.github/workflows/link-checker.yaml@main
16 changes: 16 additions & 0 deletions .github/workflows/publish-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: publish-site

on:
# Trigger the workflow on push to main branch
push:
branches:
- main
workflow_dispatch:

jobs:
build:
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main

deploy:
needs: build
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
9 changes: 9 additions & 0 deletions .github/workflows/trigger-delete-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: trigger-delete-preview

on:
pull_request_target:
types: closed

jobs:
delete:
uses: ProjectPythia/cookbook-actions/.github/workflows/delete-preview.yaml@main
7 changes: 7 additions & 0 deletions .github/workflows/trigger-link-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: trigger-link-check
on:
pull_request:

jobs:
link-check:
uses: ProjectPythia/cookbook-actions/.github/workflows/link-checker.yaml@main
27 changes: 27 additions & 0 deletions .github/workflows/trigger-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: trigger-preview
on:
workflow_run:
workflows:
- trigger-site-build
types:
- requested
- completed

jobs:
find-pull-request:
uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main
deploy-preview:
needs: find-pull-request
if: github.event.workflow_run.conclusion == 'success'
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
with:
artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }}
destination_dir: _preview/${{ needs.find-pull-request.outputs.number }} # deploy to subdirectory labeled with PR number
is_preview: "true"

preview-comment:
needs: find-pull-request
uses: ProjectPythia/cookbook-actions/.github/workflows/preview-comment.yaml@main
with:
pull_request_number: ${{ needs.find-pull-request.outputs.number }}
sha: ${{ needs.find-pull-request.outputs.sha }}
11 changes: 11 additions & 0 deletions .github/workflows/trigger-site-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: trigger-site-build
on:
pull_request:

jobs:
build:
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
with:
artifact_name: book-zip-${{ github.event.number }}
base_url: '/${{ github.event.repository.name }}/_preview/${{ github.event.number }}'
# Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml
2 changes: 1 addition & 1 deletion pythia-gallery.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ const plugin = {
transforms: [pythiaGalleryTransform],
};

export default plugin;
export default plugin;
34 changes: 4 additions & 30 deletions pythia-gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ def render_resource(resource: dict):

#if "thumbnail" in resource:
#else:
try:
thumbnail = "https://projectpythia.org/resource-gallery/" + resource['thumbnail']
except:
thumbnail = "https://projectpythia.org/_static/thumbnails/ProjectPythia_Blue.png"
thumbnail = resource.get('thumbnail') or "_static/thumbnails/ProjectPythia_Blue.png"

# Build tags
tags = resource["tags"]
Expand Down Expand Up @@ -68,34 +65,11 @@ def render_resource(resource: dict):
]
}

return {
"type": "card",
"url": resource_url,
"children": [
{"type": "cardTitle", "children": [text(title)]},
div(
[
description,
div(
[
span(
[text(item)],
style=styles.get(name, DEFAULT_STYLE),
)
for name, items in tags.items()
if items is not None
for item in items
]
),
],
),
],
}


def render_resources(pool):

resources = fetch_yaml("https://raw.githubusercontent.com/ProjectPythia/resource-gallery/main/portal/resource_gallery.yaml")
with open("resource_gallery.yml", "r") as f:
resources = yaml.load(f, yaml.SafeLoader)

return [*pool.map(render_resource, resources)]

Expand All @@ -119,4 +93,4 @@ def render_resources(pool):
node["children"] = children

# Write back to stdout!
print(json.dumps(ast))
print(json.dumps(ast))
Loading