Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
69 changes: 69 additions & 0 deletions .github/actions/rsync-deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Rsync Deploy (local)
description: Upload a folder to a single remote destination via rsync over SSH.
inputs:
switches:
description: rsync switches
required: false
default: "--archive --compress"
path:
description: Local source directory (always copies its content)
required: true
remote_path:
description: Remote destination directory
required: true
remote_host:
description: SSH host
required: true
remote_port:
description: SSH port
required: false
default: "22"
remote_user:
description: SSH username
required: true
remote_key:
description: SSH private key (OpenSSH/PEM)
required: true
known_hosts:
description: Optional known_hosts entry for the remote host
required: false
runs:
using: composite
steps:
- name: Prepare SSH
shell: bash
run: |
set -euo pipefail
install -m 700 -d ~/.ssh
printf '%s\n' "${{ inputs.remote_key }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519

SSH_PORT="${{ inputs.remote_port }}"
[[ -z "$SSH_PORT" ]] && SSH_PORT=22

if [[ -n "${{ inputs.known_hosts }}" ]]; then
printf '%s\n' "${{ inputs.known_hosts }}" > ~/.ssh/known_hosts
else
ssh-keyscan -p "$SSH_PORT" -H "${{ inputs.remote_host }}" >> ~/.ssh/known_hosts
fi

- name: Rsync upload
shell: bash
run: |
set -euo pipefail
SSH_PORT="${{ inputs.remote_port }}"
[[ -z "$SSH_PORT" ]] && SSH_PORT=22
SSH_CMD="ssh -p ${SSH_PORT} -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes"

SRC="${{ inputs.path }}"
DEST="${{ inputs.remote_path }}"
USER="${{ inputs.remote_user }}"
HOST="${{ inputs.remote_host }}"

# Ensure destination directory exists
${SSH_CMD} "${USER}@${HOST}" "mkdir -p '${DEST%/}'"

# Copy *contents* of SRC into DEST
rsync ${{ inputs.switches }} \
-e "${SSH_CMD}" \
"${SRC%/}/" "${USER}@${HOST}:'${DEST%/}/'"
6 changes: 2 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ jobs:
run: |
docker run --rm --volume "$PWD:/root/flink-kubernetes-operator" chesnay/flink-ci:java_8_11 bash -c "cd /root/flink-kubernetes-operator && ./.github/workflows/docs.sh"
- name: Upload documentation
uses: burnett01/rsync-[email protected]
uses: ./.github/actions/rsync-deploy
with:
switches: --archive --compress
path: docs/target/
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_branch }}/
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
Expand All @@ -62,9 +61,8 @@ jobs:
remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}
- name: Upload documentation alias
if: env.flink_alias != ''
uses: burnett01/rsync-[email protected]
uses: ./.github/actions/rsync-deploy
with:
switches: --archive --compress
path: docs/target/
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_alias }}/
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
Expand Down