Skip to content

Commit e3cc9dd

Browse files
authored
Create intermediate directories relative to vars.CONFIGS_INPUT_DIR rather than inputs.target, simplify logic (#25)
1 parent 688c799 commit e3cc9dd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/remote-copy.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,16 @@ jobs:
300300
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
301301
now=$(date +%Y_%m_%d_%H_%M)
302302
303-
mdss -P ${{ vars.PROJECT_CODE }} mkdir -p ${{ vars.TAPE_ROOT_DIR }}/$now
304-
305303
for file in ${{ needs.copy-to-remote.outputs.files }} ${{ needs.copy-to-remote.outputs.manifests }}; do
306-
file_relative_to_target=${file#${{ inputs.target }}/}
307-
echo "Moving '$file' to '${{ vars.TAPE_ROOT_DIR }}/$now/$file_relative_to_target'"
308-
dirs_after_target=$(dirname $file_relative_to_target)
309-
if [[ "$dirs_after_target" != "." ]]; then
310-
mdss -P ${{ vars.PROJECT_CODE }} mkdir -p ${{ vars.TAPE_ROOT_DIR }}/$now/$(dirname $file_relative_to_target)
311-
fi
312-
mdss -P ${{ vars.PROJECT_CODE }} put -r $file ${{ vars.TAPE_ROOT_DIR }}/$now/$file_relative_to_target
304+
file_relative_to_config_dir=${file#${{ vars.CONFIGS_INPUT_DIR }}/}
305+
echo "Moving '$file' to '${{ vars.TAPE_ROOT_DIR }}/$now/$file_relative_to_config_dir'"
306+
307+
# Create all intermediate directories before putting the file
308+
intermediate_dirs=$(dirname $file_relative_to_config_dir)
309+
mdss -P ${{ vars.PROJECT_CODE }} mkdir -p ${{ vars.TAPE_ROOT_DIR }}/$now/$intermediate_dirs
310+
311+
# Copy the file itself to tape
312+
mdss -P ${{ vars.PROJECT_CODE }} put $file ${{ vars.TAPE_ROOT_DIR }}/$now/$file_relative_to_config_dir
313313
done
314314
315315
echo "Output:"

0 commit comments

Comments
 (0)