Skip to content

Commit ea89499

Browse files
committed
Use rsync instead of zip/unzip
1 parent e1f8e0b commit ea89499

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

.github/workflows/deployment.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ jobs:
6666
# LICENSE version and ISO8601 timestamp
6767
echo -n "$(git log -n 1 --pretty='%h %aI' ./LICENSE.txt)" >> ./etc/.rsync-version
6868
69-
- name: Compress Artifacts
70-
run: zip -r ${{ env.CLEAN_BRANCH_NAME }}.zip . -x@etc/deploy-ignore.txt
71-
7269
- name: Deploy to Remote
7370
env:
7471
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
@@ -89,19 +86,11 @@ jobs:
8986
chmod -v 400 "${HOME}/.ssh/id_${SSH_USER}"
9087
9188
# Deploy artifact to the remote
92-
scp -i "${HOME}/.ssh/id_${SSH_USER}" -P "${SSH_PORT}" "${CLEAN_BRANCH_NAME}.zip" "${SSH_USER}@${SSH_HOST}:${SSH_WEB_PATH}/"
93-
94-
# SSH to remote and process artifact
95-
ssh -i "${HOME}/.ssh/id_${SSH_USER}" -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" << EOF
96-
set -ex -o pipefail
97-
cd ${SSH_WEB_PATH}/
98-
rm -rfv ./${CLEAN_BRANCH_NAME}/
99-
mkdir -pv ./${CLEAN_BRANCH_NAME}/
100-
mv -v ./${CLEAN_BRANCH_NAME}.zip ./${CLEAN_BRANCH_NAME}/
101-
cd ./${CLEAN_BRANCH_NAME}/
102-
unzip -o ./${CLEAN_BRANCH_NAME}.zip
103-
rm ./${CLEAN_BRANCH_NAME}.zip
104-
EOF
89+
rsync -avzc --delete --delete-excluded --delete-after --progress \
90+
--exclude-from="./etc/deploy-ignore.txt" \
91+
--chown=${SSH_USER}:${SSH_USER} \
92+
-e "ssh -i ${HOME}/.ssh/id_${SSH_USER} -p ${SSH_PORT}" \
93+
"./" "${SSH_USER}@${SSH_HOST}:${SSH_WEB_PATH}"
10594
10695
# Cleanup the secret
10796
rm -fv "${HOME}/.ssh/id_${SSH_USER}" "${HOME}/.ssh/id_${SSH_USER}.pub"

0 commit comments

Comments
 (0)