Skip to content
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

GitHub Action to publish documentation updates #12

Merged
merged 1 commit into from
Feb 22, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/scripts/rsync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2024 the Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
#
#
# $1: ssh_login_username
# $2: remote_server_ip
# $3: ssh_port
# $4: source_path
# $5: destination_path
# $6: ssh_private_key_file

# set -euo pipefail

SSH_COMMAND="ssh -p $3 -i $6 -o StrictHostKeyChecking=no"

echo =========================================================================

start_time=$(date)

echo "{start_time}={start_time}" >> $GITHUB_OUTPUT
echo "Start time of synchronization -> $start_time"

rsync -e "$SSH_COMMAND" -av $4 $1@$2:$5
if [ $? -ne 0 ]; then
echo "rsync command failed"
exit 1
fi

end_time=$(date)

echo "{end_time}={end_time}" >> $GITHUB_OUTPUT
echo "End time of synchronization -> $end_time"

echo =========================================================================

exit 0
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation

name: Publish Docs Workflow
run-name: ${{ github.actor }} is publishing document artifacts 🚀

on:
- push
- workflow_dispatch

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build docs
run: make html

- name: List built files
run: |
files=$(ls ${{ github.workspace }}/_build/html)
if [ -z "$files" ]; then
echo "No files found in _build/html directory"
exit 1
else
echo "$files"
fi

publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build docs
run: make multiversion

- name: List built files
run: ls ${{ github.workspace }}/_build/multiversion/*

- name: Prep private key
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" >> ${{ github.workspace }}/id_rsa
chmod 600 ${{ github.workspace }}/id_rsa

- name: Run rsync script
run: ./.github/scripts/rsync.sh ${{ secrets.SSH_LOGIN_USERNAME }} ${{ secrets.REMOTE_SERVER_IP }} ${{ secrets.SSH_PORT }} ${{ github.workspace }}/_build/multiversion/master /srv/sites/docs.sd-core.opennetworking.org ${{ github.workspace }}/id_rsa
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ _build
.vscode
.env
.DS_Store
.swp
3 changes: 2 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_version():
prep_commands = [
]

# include only the branches matching master and aether-*
# include only the branches matching master and sdcore-*
smv_branch_whitelist = r'^(master|sdcore-.*)$'

# Don't include any tags - smv docs say you can put None here, but that is broken
Expand Down Expand Up @@ -253,6 +253,7 @@ def get_version():
linkcheck_ignore = [
r'https://jenkins.aetherproject.org/.*',
r'https://gerrit.opencord.org/.*',
r'https://wiki.opennetworking.org/.*',
]

linkcheck_timeout = 3
Expand Down