Skip to content

Commit 4b7038f

Browse files
committed
[FLINK-38448] Replace burnett01/rsync-deployments with a custom rsync-deploy action in docs.yaml
1 parent ef31965 commit 4b7038f

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Rsync Deploy (local)
2+
description: Upload a folder to a single remote destination via rsync over SSH.
3+
inputs:
4+
switches:
5+
description: rsync switches
6+
required: false
7+
default: "--archive --compress"
8+
path:
9+
description: Local source directory (always copies its content)
10+
required: true
11+
remote_path:
12+
description: Remote destination directory
13+
required: true
14+
remote_host:
15+
description: SSH host
16+
required: true
17+
remote_port:
18+
description: SSH port
19+
required: false
20+
default: "22"
21+
remote_user:
22+
description: SSH username
23+
required: true
24+
remote_key:
25+
description: SSH private key (OpenSSH/PEM)
26+
required: true
27+
known_hosts:
28+
description: Optional known_hosts entry for the remote host
29+
required: false
30+
runs:
31+
using: composite
32+
steps:
33+
- name: Prepare SSH
34+
shell: bash
35+
run: |
36+
set -euo pipefail
37+
install -m 700 -d ~/.ssh
38+
printf '%s\n' "${{ inputs.remote_key }}" > ~/.ssh/id_ed25519
39+
chmod 600 ~/.ssh/id_ed25519
40+
41+
SSH_PORT="${{ inputs.remote_port }}"
42+
[[ -z "$SSH_PORT" ]] && SSH_PORT=22
43+
44+
if [[ -n "${{ inputs.known_hosts }}" ]]; then
45+
printf '%s\n' "${{ inputs.known_hosts }}" > ~/.ssh/known_hosts
46+
else
47+
ssh-keyscan -p "$SSH_PORT" -H "${{ inputs.remote_host }}" >> ~/.ssh/known_hosts
48+
fi
49+
50+
- name: Rsync upload
51+
shell: bash
52+
run: |
53+
set -euo pipefail
54+
SSH_PORT="${{ inputs.remote_port }}"
55+
[[ -z "$SSH_PORT" ]] && SSH_PORT=22
56+
SSH_CMD="ssh -p ${SSH_PORT} -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes"
57+
58+
SRC="${{ inputs.path }}"
59+
DEST="${{ inputs.remote_path }}"
60+
USER="${{ inputs.remote_user }}"
61+
HOST="${{ inputs.remote_host }}"
62+
63+
# Ensure destination directory exists
64+
${SSH_CMD} "${USER}@${HOST}" "mkdir -p '${DEST%/}'"
65+
66+
# Copy *contents* of SRC into DEST
67+
rsync ${{ inputs.switches }} \
68+
-e "${SSH_CMD}" \
69+
"${SRC%/}/" "${USER}@${HOST}:'${DEST%/}/'"

.github/workflows/docs.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ jobs:
5151
run: |
5252
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"
5353
- name: Upload documentation
54-
uses: burnett01/rsync-[email protected]
54+
uses: ./.github/actions/rsync-deploy
5555
with:
56-
switches: --archive --compress
5756
path: docs/target/
5857
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_branch }}/
5958
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
@@ -62,9 +61,8 @@ jobs:
6261
remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}
6362
- name: Upload documentation alias
6463
if: env.flink_alias != ''
65-
uses: burnett01/rsync-[email protected]
64+
uses: ./.github/actions/rsync-deploy
6665
with:
67-
switches: --archive --compress
6866
path: docs/target/
6967
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_alias }}/
7068
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}

0 commit comments

Comments
 (0)