From e321f95986464e9efb06a32461f628e1811b5831 Mon Sep 17 00:00:00 2001 From: Larry Peterson Date: Tue, 6 Feb 2024 10:15:34 -0700 Subject: [PATCH] github actions --- .github/scripts/rsync.sh | 30 ++++++++++++++++++++++++++++++ .github/workflows/publish-docs.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/scripts/rsync.sh create mode 100644 .github/workflows/publish-docs.yml diff --git a/.github/scripts/rsync.sh b/.github/scripts/rsync.sh new file mode 100644 index 0000000..b581954 --- /dev/null +++ b/.github/scripts/rsync.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# $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 diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000..9187356 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,28 @@ +name: Publish Docs Workflow +run-name: ${{ github.actor }} is publishing document artifacts 🚀 +on: [push, workflow_dispatch] +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: 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 rsync_test ${{ github.workspace }}/id_rsa + + - run: echo "🍏 This job's status is ${{ job.status }}."