Skip to content

Add workfow to publishing docs #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
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
61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: "Publish pulpproject.org"
on:
schedule:
- cron: "00 3 * * 1-5"
workflow_dispatch:

defaults:
run:
working-directory: "pulp-docs"

jobs:
build-docs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
path: "pulp-docs"
- uses: "actions/setup-python@v5"
with:
python-version: "3.13"
- name: "Build HTML site for pulpproject.org."
run: |
.github/workflows/scripts/build_all_docs.sh
- name: "Upload documentation site"
uses: "actions/upload-artifact@v4"
with:
name: "pulpproject.org.tar"
path: "pulp-docs/pulpproject.org.tar"
if-no-files-found: "error"

publish-docs:
runs-on: "ubuntu-latest"
needs:
- "build-docs"

env:
PULP_DOCS_KEY: "${{ secrets.PULP_DOCS_KEY }}"

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 1
path: "pulp-docs"

- uses: "actions/setup-python@v5"
with:
python-version: "3.13"

- name: "Download built docs"
uses: "actions/download-artifact@v4"
with:
name: "pulpproject.org.tar"
path: "pulp-docs/"

- name: "Publish docs to pulpproject.org"
run: |
.github/workflows/scripts/publish_all_docs.sh
...
11 changes: 11 additions & 0 deletions .github/workflows/scripts/build_all_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# This script builds the documentation site for pulpproject.org

set -euv

FETCHDIR="/tmp/fetchdir"
pip install .
pulp-docs fetch --dest "$FETCHDIR"
pulp-docs build --path "$FETCHDIR"
tar cvf pulpproject.org.tar site
27 changes: 27 additions & 0 deletions .github/workflows/scripts/publish_all_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -euv

# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")/../../.."

mkdir ~/.ssh
touch ~/.ssh/pulp-infra
chmod 600 ~/.ssh/pulp-infra
echo "$PULP_DOCS_KEY" > ~/.ssh/pulp-infra

echo "docs.pulpproject.org,8.43.85.236 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGXG+8vjSQvnAkq33i0XWgpSrbco3rRqNZr0SfVeiqFI7RN/VznwXMioDDhc+hQtgVhd6TYBOrV07IMcKj+FAzg=" >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts

# start the ssh agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/pulp-infra

mkdir -p ../pulpproject.org
tar -xvf pulpproject.org.tar --directory ../pulpproject.org
pushd ../pulpproject.org

# publish to pulpproject.org
rsync -avzh --delete site/ doc_builder_staging_pulp_core@docs.pulpproject.org:/var/www/docs.pulpproject.org/staging_pulp_core/

popd