Skip to content

Commit 1df9a1e

Browse files
GreatEugeniusxintongsong
authored andcommitted
[ci] Add local rsync-deployments composite action
Add a local composite action under .github/actions/rsync-deployments that wraps rsync-over-SSH for documentation deployment. Ported from apache/flink-kubernetes-operator#1035 with MIT attribution preserved. This action is intended to replace the third-party burnett01/rsync-deployments action, which is not in the ASF allowed-actions list. Locally-defined actions are not subject to that allow-list, so they can be used safely in ASF repositories. This commit is purely additive (no existing files modified) and can be cherry-picked cleanly to release branches so the nightly docs matrix job can resolve the local action when checking out those branches.
1 parent e4886af commit 1df9a1e

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
The local composite action at .github/actions/rsync-deployments/action.yml
2+
was inspired by the rsync-deployments GitHub Action, which is distributed
3+
under the MIT License reproduced below.
4+
5+
MIT License
6+
7+
Copyright (c) 2019-2022 Contention
8+
Copyright (c) 2019-2025 Burnett01
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a copy
11+
of this software and associated documentation files (the "Software"), to deal
12+
in the Software without restriction, including without limitation the rights
13+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
copies of the Software, and to permit persons to whom the Software is
15+
furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included in all
18+
copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
SOFTWARE.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# This implementation took inspiration from https://github.com/Burnett01/rsync-deployments/blob/7.1.0/action.yml
17+
name: Rsync Deploy (local)
18+
description: Upload a folder to a single remote destination via rsync over SSH.
19+
inputs:
20+
switches:
21+
description: rsync switches
22+
required: false
23+
default: "--archive --compress"
24+
path:
25+
description: Local source directory
26+
required: true
27+
remote_path:
28+
description: Remote destination directory
29+
required: true
30+
remote_host:
31+
description: SSH host
32+
required: true
33+
remote_port:
34+
description: SSH port
35+
required: false
36+
default: "22"
37+
remote_user:
38+
description: SSH username
39+
required: true
40+
remote_key:
41+
description: SSH private key (OpenSSH/PEM)
42+
required: true
43+
runs:
44+
using: composite
45+
steps:
46+
- name: rsync via ssh-agent
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
51+
# Start agent and load the key
52+
eval "$(ssh-agent -s)"
53+
ssh-add - <<< "${{ inputs.remote_key }}"
54+
55+
# SSH command with host key checking disabled (matches your reference impl)
56+
RSH="ssh -o StrictHostKeyChecking=no -p ${{ inputs.remote_port }}"
57+
58+
# Resolve paths and DSN
59+
LOCAL_PATH="$GITHUB_WORKSPACE/${{ inputs.path }}"
60+
DSN="${{ inputs.remote_user }}@${{ inputs.remote_host }}"
61+
62+
# Deploy
63+
sh -c "rsync ${{ inputs.switches }} -e '$RSH' $LOCAL_PATH $DSN:${{ inputs.remote_path }}"
64+
65+
# Cleanup identities from the agent
66+
ssh-add -D || true

0 commit comments

Comments
 (0)