Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
50 changes: 36 additions & 14 deletions .github/workflows/docbuild-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ jobs:
exit 1
fi
# Docs for all patch releases of a minor series are published under
# the same major.minor path, e.g. 3.0.5 -> pandas-docs/version/3.0
if [[ -n "$PANDAS_VERSION" ]]; then
PANDAS_DOCS_VERSION=$(echo "$PANDAS_VERSION" | grep -oE '^[0-9]+\.[0-9]+')
Comment thread
rhshadrach marked this conversation as resolved.
echo "PANDAS_DOCS_VERSION=$PANDAS_DOCS_VERSION" >> "$GITHUB_ENV"
fi
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -145,28 +152,43 @@ jobs:
ci-build-documentation \
zip_html
- name: Install ssh key
run: |
mkdir -m 700 -p ~/.ssh
echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFjYkJBk7sos+r7yATODogQc3jUdW1aascGpyOD4bohj8dWjzwLJv/OJ/fyOQ5lmj81WKDk67tGtqNJYGL9acII=" > ~/.ssh/known_hosts
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))) || github.event_name == 'workflow_dispatch'

- name: Copy cheatsheets into site directory
run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/

- name: Checkout pandas-dev.github.io
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: pandas-dev/pandas-dev.github.io
ssh-key: ${{ secrets.PANDAS_DEV_GITHUB_IO_DEPLOY_KEY }}
path: pandas-dev.github.io
persist-credentials: true
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || env.PUBLISH_PROD == 'true'
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

- name: Upload web
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' --exclude='benchmarks' web/build/ web@${{ secrets.server_ip }}:/var/www/html
if: false # github.event_name == 'push' && github.ref == 'refs/heads/main'
run: rsync -a --delete --exclude='.git' --exclude='README.md' --exclude='CNAME' --exclude='.nojekyll' --exclude='pandas-docs' --exclude='docs' --exclude='benchmarks' web/build/ pandas-dev.github.io/
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

- name: Upload dev docs
run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/dev
if: false # github.event_name == 'push' && github.ref == 'refs/heads/main'
run: rsync -a --delete doc/build/html/ pandas-dev.github.io/pandas-docs/dev
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

- name: Upload prod docs
run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/version/${{ env.PANDAS_VERSION }}
if: false # ${{ env.PUBLISH_PROD == 'true' }}
run: rsync -a --delete doc/build/html/ pandas-dev.github.io/pandas-docs/version/${PANDAS_DOCS_VERSION}
if: env.PUBLISH_PROD == 'true'

- name: Commit and push to pandas-dev.github.io
working-directory: pandas-dev.github.io
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No changes to publish"
exit 0
fi
git commit -m "Update site from pandas-dev/pandas@${GITHUB_SHA}"
git push
Comment thread
rhshadrach marked this conversation as resolved.
Outdated
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || env.PUBLISH_PROD == 'true'

- name: Move docs into site directory
run: mv doc/build/html web/build/docs
Expand Down
32 changes: 26 additions & 6 deletions web/pandas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,14 @@ def maintainers_add_info(context):
break

resp.raise_for_status()
maintainers_info[user] = resp.json()
# only keep the fields used in the templates; the full response also
# includes other fields that change independently (e.g. follower
# count), causing a diff on every rebuild
user_json = resp.json()
maintainers_info[user] = {
key: user_json[key]
for key in ("name", "login", "avatar_url", "html_url", "blog")
}

context["maintainers"]["github_info"] = maintainers_info

Expand Down Expand Up @@ -230,6 +237,23 @@ def home_add_releases(context):
resp.raise_for_status()
releases = resp.json()

# only keep the fields actually used when rendering the site; the full
# response also includes fields like download_count, causing the file
# to change on every rebuild
releases = [
{
"tag_name": release["tag_name"],
"published_at": release["published_at"],
"prerelease": release["prerelease"],
"browser_download_url": (
release["assets"][0]["browser_download_url"]
if release["assets"]
else ""
),
}
for release in releases
]

with open(
pathlib.Path(context["target_path"]) / "releases.json",
"w",
Expand All @@ -249,11 +273,7 @@ def home_add_releases(context):
"parsed_version": version.parse(release["tag_name"].lstrip("v")),
"tag": release["tag_name"],
"published": published,
"url": (
release["assets"][0]["browser_download_url"]
if release["assets"]
else ""
),
"url": release["browser_download_url"],
Comment thread
rhshadrach marked this conversation as resolved.
}
)
# sorting out obsolete versions
Expand Down