diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b5b1918..9e777cc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,10 +12,10 @@ jobs: if: github.repository == 'ProjectPythiaCookbooks/projectpythiacookbooks.github.io' steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: conda-incubator/setup-miniconda@master with: @@ -41,7 +41,7 @@ jobs: rm -rf site.zip fi zip -r site.zip ./site/_build/html - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: site-zip path: ./site.zip diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 4264aba..ad67c34 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -14,12 +14,12 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set message value run: | echo "comment_message=This pull request is being automatically built with [GitHub Actions](https://github.com/features/actions) and [Netlify](https://www.netlify.com/). To see the status of your deployment, click below." >> $GITHUB_ENV - name: Find Pull Request - uses: actions/github-script@v4 + uses: actions/github-script@v6 id: find-pull-request with: script: | @@ -45,7 +45,7 @@ jobs: core.info(`Found pull request ${pullRequestNumber}, with head sha: ${pullRequestHeadSHA}`) } - name: Find Comment - uses: peter-evans/find-comment@v1 + uses: peter-evans/find-comment@v2 if: steps.find-pull-request.outputs.number != '' id: fc with: @@ -57,7 +57,7 @@ jobs: github.event.workflow_run.conclusion != 'success' && steps.find-pull-request.outputs.number != '' && steps.fc.outputs.comment-id == '' - uses: peter-evans/create-or-update-comment@v1 + uses: peter-evans/create-or-update-comment@v2 with: issue-number: ${{ steps.find-pull-request.outputs.number }} body: | @@ -69,7 +69,7 @@ jobs: github.event.workflow_run.conclusion != 'success' && steps.find-pull-request.outputs.number != '' && steps.fc.outputs.comment-id != '' - uses: peter-evans/create-or-update-comment@v1 + uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace @@ -82,7 +82,7 @@ jobs: github.event.workflow_run.conclusion == 'success' && steps.find-pull-request.outputs.number != '' && steps.fc.outputs.comment-id != '' - uses: dawidd6/action-download-artifact@v2.14.1 + uses: dawidd6/action-download-artifact@v2.21.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} workflow: ci.yaml @@ -119,7 +119,7 @@ jobs: github.event.workflow_run.conclusion == 'success' && steps.find-pull-request.outputs.number != '' && steps.fc.outputs.comment-id != '' - uses: peter-evans/create-or-update-comment@v1 + uses: peter-evans/create-or-update-comment@v2 with: comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace diff --git a/README.md b/README.md index 215fc07..88c9932 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # projectpythiatutorials.github.io Root site for the ProjectPythiaTutorials GitHub Pages + +projectpythiacookbooks.github.io diff --git a/site/_extensions/gallery_generator.py b/site/_extensions/gallery_generator.py index d638b0f..a294996 100644 --- a/site/_extensions/gallery_generator.py +++ b/site/_extensions/gallery_generator.py @@ -5,6 +5,29 @@ from truncatehtml import truncate +def _generate_url_from_repo(repo): + cookbook_url = f'https://cookbooks.projectpythia.org/{repo}/README.html' + return cookbook_url + + +def _generate_github_url_from_repo(repo): + github_url = f'https://github.com/ProjectPythiaCookbooks/{repo}' + return github_url + + +#def _get_thumbnail_url(repo): +# github_url = _generate_github_url_from_repo(repo) +# return f'{github_url}/thumbnail.png' + + +def _generate_status_badge_html(repo): + github_url = _generate_github_url_from_repo(repo) + + return f""" + nightly-build + Binder + """ + def _generate_sorted_tag_keys(all_items): key_set = set(itertools.chain(*[item['tags'].keys() for item in all_items])) @@ -71,13 +94,19 @@ def build_from_items(items, filename, title='Gallery', subtitle=None, subtext=No # Build the gallery file panels_body = [] for item in items: + repo = item['repo'] + #thumbnail = _get_thumbnail_url(repo) + cookbook_url = _generate_url_from_repo(repo) + status_badges = _generate_status_badge_html(repo) + if not item.get('thumbnail'): item['thumbnail'] = '/_static/images/ebp-logo.png' thumbnail = item['thumbnail'] + tag_list = sorted((itertools.chain(*item['tags'].values()))) tag_list_f = [tag.replace(' ', '-') for tag in tag_list] - tags = [f'{tag}' for tag in tag_list_f] + tags = [f'{tag}' for tag in tag_list_f] tags = '\n'.join(tags) tag_class_str = ' '.join(tag_list_f) @@ -122,7 +151,7 @@ def build_from_items(items, filename, title='Gallery', subtitle=None, subtext=No {institutions_str}

{item['description']}

{tags}

-

Visit Website

+

Visit Website

""" @@ -137,7 +166,7 @@ def build_from_items(items, filename, title='Gallery', subtitle=None, subtext=No