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

INF-935 (work on publishing docs) #11

Closed
wants to merge 7 commits into from
Closed
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
33 changes: 33 additions & 0 deletions .github/scripts/rsync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/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

end_time=$(date)

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

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

exit 0
37 changes: 37 additions & 0 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2024 the Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
name: Publish Docs Workflow
run-name: ${{ github.actor }} is publishing document artifacts 🚀
on:
push:
branches:
- master
- dev-daf

jobs:
Publish_Docs:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repo
uses: actions/checkout@v4
- name: Validate reST source
run: make test
- 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: |
chmod +x ./.github/scripts/rsync.sh
./.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

- run: echo "🍏 This job's status is ${{ job.status }}."
23 changes: 23 additions & 0 deletions .github/workflows/validate-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2024 the Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
name: Validate Docs Workflow
run-name: ${{ github.actor }} is validating document source
on: [pull_request, workflow_dispatch]
jobs:
Validate_Docs:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repo
uses: actions/checkout@v4
- name: Validate reST source
run: make test
- name: Build docs
run: make html
- name: List built files
run: |
ls ${{ github.workspace }}/_build/html

- run: echo "🍏 This job's status is ${{ job.status }}."
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SHELL = bash -e -o pipefail

# You can set these variables from the command line.
SPHINXOPTS ?= -W
SPHINXOPTS ?= -W
SPHINXBUILD ?= sphinx-build
SOURCEDIR ?= .
BUILDDIR ?= _build
Expand Down