Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
llpeterson committed Feb 6, 2024
1 parent a3e015c commit e321f95
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/scripts/rsync.sh
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -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 }}."

0 comments on commit e321f95

Please sign in to comment.