Skip to content

Commit 39ed48e

Browse files
author
Greg Bowler
committed
feature: chown after running after-command
1 parent 1500b61 commit 39ed48e

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Diff for: action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ inputs:
2828
path_owner:
2929
description: The user and group to change ownership of deployment path to after transfer
3030
required: false
31-
default: "."
3231

3332
transfer_path:
3433
description: Absolute path on the remote server to use for the transfer, which will contain a directory named as the current Git SHA

Diff for: deploy-action.bash

+15-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,22 @@ tar -czf - --exclude-vcs . | \
3737
"rm -rf $full_transfer_path && mkdir -p $full_transfer_path && cd $full_transfer_path && tar -xzf - && mv ./post-transfer.bash $ACTION_POST_TRANSFER_SCRIPT && echo $ACTION_POST_TRANSFER_SCRIPT_PREFIX $ACTION_POST_TRANSFER_SCRIPT && $ACTION_POST_TRANSFER_SCRIPT_PREFIX $ACTION_POST_TRANSFER_SCRIPT"
3838
echo "Transfer complete"
3939

40+
deployed_dir="$ACTION_PATH/$GITHUB_REF_NAME"
4041
if [ -n "$ACTION_AFTER_COMMAND" ]
4142
then
4243
echo "Running after command: $ACTION_AFTER_COMMAND"
43-
eval "$ACTION_AFTER_COMMAND"
44+
ssh \
45+
-i "$ssh_key_path" \
46+
-p "$ACTION_PORT" \
47+
"$ACTION_USER"@"$ACTION_HOSTNAME" \
48+
"cd $deployed_dir && $ACTION_AFTER_COMMAND"
49+
fi
50+
51+
if [ -n "$ACTION_PATH_OWNER" ]
52+
then
53+
ssh \
54+
-i "$ssh_key_path" \
55+
-p "$ACTION_PORT" \
56+
"$ACTION_USER"@"$ACTION_HOSTNAME" \
57+
"cd $deployed_dir && chown -R $ACTION_PATH_OWNER ."
4458
fi

Diff for: remote-post-transfer.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ then
2121
fi
2222

2323
mv "$source_dir" "$destination_dir"
24-
chown -R "$ACTION_PATH_OWNER" "$destination_dir"
24+
#chown -R "$ACTION_PATH_OWNER" "$destination_dir"
2525

2626
echo "Completed post-transfer script"
2727

0 commit comments

Comments
 (0)