Switch to staging docs on kivy-website-docs (#7179)

* Switch to staging docs on kivy-website-docs.

* Use correct path.

* Track changes rather than resetting every time.
This commit is contained in:
matham 2020-10-26 13:17:46 -04:00 committed by GitHub
parent b160e73446
commit b9dd8fd508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 21 deletions

View File

@ -133,24 +133,30 @@ generate_docs() {
}
upload_docs_to_server() {
versions=$1
branch=$2
ip=$3
branch="docs-$1"
commit="$2"
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
# only upload docs if we have a branch for it
if [ -z "$(git ls-remote --heads https://github.com/kivy/kivy-website-docs.git "$branch")" ]; then
return
fi
printf "%s" "$UBUNTU_UPLOAD_KEY" >~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host $ip\n\tStrictHostKeyChecking no\n" >>~/.ssh/config
for version in $versions; do
if [ "$version" == "${branch}" ]; then
echo "[$(echo $versions | tr ' ' ', ' | sed -s 's/\([^,]\+\)/"\1"/g')]" >versions.json
rsync --force -e "ssh -p 2457" versions.json root@$ip:/web/doc/
rsync --delete --force -r -e "ssh -p 2457" ./doc/build/html/ root@$ip:/web/doc/$version
fi
done
git clone --depth 1 --branch "$branch" https://github.com/kivy/kivy-website-docs.git
cd kivy-website-docs
git config user.email "kivy@kivy.org"
git config user.name "Kivy bot"
git remote rm origin || true
git remote add origin "https://x-access-token:${DOC_PUSH_TOKEN}@github.com/kivy/kivy-website-docs.git"
rsync --delete --force --exclude .git/ --exclude .gitignore -r ../doc/build/html/ .
git add .
git add -u
if ! git diff --cached --exit-code --quiet; then
git commit -m "Docs for git-$commit"
git push origin "$branch"
fi
}
generate_manylinux2010_wheels() {

View File

@ -4,8 +4,6 @@ on: [push, pull_request]
env:
KIVY_SPLIT_EXAMPLES: 1
SERVER_IP: '159.203.106.198'
DOC_VERSIONS: 'stable master stable-1.10.1 stable-1.11.0'
jobs:
PEP8_test:
@ -86,12 +84,12 @@ jobs:
with:
name: docs
path: doc/build/html
- name: Upload docs to server
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/stable'))
- name: Upload docs to kivy-website-docs
if: github.event_name == 'push'
env:
REF_NAME: ${{ github.ref }}
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
DOC_PUSH_TOKEN: ${{ secrets.DOC_PUSH_TOKEN }}
run: |
branch_name=$(python3 -c "print('$REF_NAME'.split('/')[-1])")
source .ci/ubuntu_ci.sh
upload_docs_to_server "$DOC_VERSIONS" "$branch_name" "$SERVER_IP"
upload_docs_to_server "$branch_name" "$GITHUB_SHA"