Skip to content

Commit

Permalink
Rework docs publishing
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
mdellweg authored and ggainey committed Jul 21, 2023
1 parent e6b12c6 commit 49e3db1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
28 changes: 15 additions & 13 deletions .ci/scripts/publish_docs.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
#!/bin/bash

# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
# './plugin-template --github pulpcore' to update this file.
#
# For more info visit https://github.com/pulp/plugin_template

set -euv

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

REF="${1#refs/}"
REF_NAME="${REF#*/}"
REF_TYPE="${REF%%/*}"

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

echo "docs.pulpproject.org,8.43.85.236 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGXG+8vjSQvnAkq33i0XWgpSrbco3rRqNZr0SfVeiqFI7RN/VznwXMioDDhc+hQtgVhd6TYBOrV07IMcKj+FAzg=" >> /home/runner/.ssh/known_hosts
Expand All @@ -26,8 +23,13 @@ ssh-add ~/.ssh/pulp-infra

make site

# publish to docs.pulpproject.org/pulp_cli
rsync -avzh site/ [email protected]:/var/www/docs.pulpproject.org/pulp_cli/

# publish to docs.pulpproject.org/pulp_cli/en/{release}
rsync -avzh site/ [email protected]:/var/www/docs.pulpproject.org/pulp_cli/en/"$1"
if [ "${REF_TYPE}" = "heads" ]
then
[ "${REF_NAME}" = "main" ]
# publish to docs.pulpproject.org/pulp_cli
rsync -avzh site/ [email protected]:/var/www/docs.pulpproject.org/pulp_cli/
else
[ "${REF_TYPE}" = "tags" ]
# publish to docs.pulpproject.org/pulp_cli/en/{release}
rsync -avzh site/ [email protected]:/var/www/docs.pulpproject.org/pulp_cli/en/"${REF_NAME}"
fi
15 changes: 4 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ jobs:
cd ..
python setup.py sdist bdist_wheel
twine upload dist/*
publish-docs:
name: Publish docs
needs: publish-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run publish docs script
env:
PULP_DOCS_KEY: ${{ secrets.PULP_DOCS_KEY }}
run: |
.ci/scripts/publish_docs.sh "${GITHUB_REF##*/}"
needs:
- publish-pypi
uses: "./.github/workflows/publish_docs.yml"
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: pulp-cli Publish Docs

on:
push:
branches:
- "main"
paths:
- "docs/**"
workflow_dispatch:
workflow_call:

jobs:
publish-docs:
name: Publish docs
needs: publish-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run publish docs script
env:
PULP_DOCS_KEY: ${{ secrets.PULP_DOCS_KEY }}
run: |
.ci/scripts/publish_docs.sh "${GITHUB_REF}"

0 comments on commit 49e3db1

Please sign in to comment.