File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ inputs:
25
25
required : true
26
26
default : " /app"
27
27
28
+ path_owner :
29
+ description : The user and group to change ownership of deployment path to after transfer
30
+ required : false
31
+ default : " ."
32
+
28
33
transfer_path :
29
34
description : Absolute path on the remote server to use for the transfer, which will contain a directory named as the current Git SHA
30
35
required : true
51
56
ACTION_USER : ${{ inputs.user }}
52
57
ACTION_PATH : ${{ inputs.path }}
53
58
ACTION_TRANSFER_PATH : ${{ inputs.transfer_path }}
59
+ ACTION_PATH_OWNER : ${{ inputs.path_owner }}
54
60
ACTION_POST_TRANSFER_SCRIPT : ${{ inputs.post_transfer_script }}
55
61
ACTION_POST_TRANSFER_SCRIPT_PREFIX : ${{ inputs.post_transfer_script_prefix }}
56
62
id : deploy_run
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ action_dir="$(dirname -- "${BASH_SOURCE[0]}")"
19
19
echo " #!/bin/bash" ; \
20
20
declare -p \
21
21
ACTION_PATH \
22
+ ACTION_PATH_OWNER \
22
23
GITHUB_REF_NAME \
23
24
full_transfer_path \
24
25
; \
Original file line number Diff line number Diff line change @@ -5,17 +5,23 @@ destination_dir_prev="$destination_dir.previous"
5
5
6
6
echo " Started post-transfer script with source ($source_dir ) destination ($destination_dir )"
7
7
8
+ if [[ ! -d " $ACTION_PATH " ]]
9
+ then
10
+ mkdir -p " $ACTION_PATH "
11
+ fi
12
+
8
13
if [[ -d " $destination_dir " ]]
9
14
then
10
15
if [[ -d " $destination_dir_prev " ]]
11
16
then
12
- echo rm -rf " $destination_dir_prev "
17
+ rm -rf " $destination_dir_prev "
13
18
fi
14
19
15
- echo mv " $destination_dir " " $destination_dir_prev "
20
+ mv " $destination_dir " " $destination_dir_prev "
16
21
fi
17
22
18
- echo mv " $source_dir " " $destination_dir "
23
+ mv " $source_dir " " $destination_dir "
24
+ chown -R " $ACTION_PATH_OWNER " " $destination_dir "
19
25
20
26
echo " Completed post-transfer script"
21
27
You can’t perform that action at this time.
0 commit comments