Skip to content

fixes to redirect issues in deployment #666

fixes to redirect issues in deployment

fixes to redirect issues in deployment #666

Workflow file for this run

# .github/workflows/site.yml
name: site
on:
push:
branches: [main]
tags-ignore: ['**']
pull_request:
schedule:
- cron: '0 10 * * 6' # Runs at 10:00 UTC every Saturday
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "${{ github.ref }}-pages"
cancel-in-progress: true
env:
SITE_PREFIX: state-of-open-source-ai
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: pip install -r requirements.txt pyyaml
- name: Check CITATION.cff & .zenodo.json
run: |
python <<EOF
import json, yaml
cff = yaml.safe_load(open("CITATION.cff"))
zen = json.load(open(".zenodo.json"))
assert cff['title'] == zen['title'] + " Book"
assert len(cff['authors']) - 1 == len(zen['creators'])
for cauth, zauth in zip(cff['authors'][:-1], zen['creators']):
assert zauth['name'] == f"{cauth['family-names']}, {cauth['given-names']}"
assert zauth.get('affiliation', "") == cauth.get('affiliation', "")
assert zauth.get('orcid', "") == cauth.get('orcid', "").rsplit("/", 1)[-1]
assert [{'name': cff['authors'][-1]['name'], 'type': "Other"}] == zen['contributors']
assert cff['abstract'] == zen['description']
assert cff['url'] == zen['related_identifiers'][0]['identifier']
assert cff['keywords'] == zen['keywords']
EOF
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- id: pages
uses: actions/configure-pages@v3
- run: pip install -r requirements.txt
- name: Jupyter Book Build
run: |
sudo apt update -qq
sudo apt install -qq ghostscript fonts-freefont-otf # Install necessary packages
# Build the book in dirhtml format, treating warnings as errors
jupyter-book build --builder dirhtml --warningiserror --nitpick --keep-going .
# Fix canonical links to remove .html suffix
sed -ri 's#(.*link rel="canonical" href=".*)\.html(".*)#\1/\2#' _build/dirhtml/*/index.html
# Removed LaTeX build step to prevent 'book.tex' not found error
- name: Prepare _site Pages
run: |
mkdir _site
mv _build/dirhtml _site/$SITE_PREFIX
# Create a minimal root redirect (optional)
echo '<!DOCTYPE html>
<html>

Check failure on line 93 in .github/workflows/pages.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pages.yml

Invalid workflow file

You have an error in your yaml syntax on line 93
<head>
<meta http-equiv="refresh" content="0; url=https://book.premai.io/state-of-open-source-ai/">
<title>Redirecting…</title>
</head>
<body>
<p>Redirecting to <a href="https://book.premai.io/state-of-open-source-ai/">State of Open Source AI</a>.</p>
</body>
</html>' > _site/index.html
- uses: actions/upload-pages-artifact@v2
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [check, build]
steps:
- id: deployment
uses: actions/deploy-pages@v2