Skip to content

Commit e7f543d

Browse files
committed
fixup! chore: add deployment CI to OVH
1 parent c43d199 commit e7f543d

1 file changed

Lines changed: 8 additions & 32 deletions

File tree

.github/workflows/ovh.yaml

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Install dependencies
5757
run: |
5858
sudo apt-get update
59-
sudo apt-get install -y sshfs
59+
sudo apt-get install -y lftp
6060
- name: Build
6161
if: ${{ inputs.action != 'teardown' }}
6262
env:
@@ -86,50 +86,26 @@ jobs:
8686
env:
8787
OVH_USERNAME: ${{ secrets.OVH_USERNAME }}
8888
OVH_HOSTNAME: ${{ secrets.OVH_HOSTNAME }}
89-
OVH_PASSWORD: ${{ secrets.OVH_PASSWORD }}
89+
LFTP_PASSWORD: ${{ secrets.OVH_PASSWORD }}
9090
TARGET: ${{ inputs.target }}
9191
run: |
9292
set -exo pipefail
9393
mkdir -p ${HOME}/.ssh/
94-
mkdir -p /tmp/ovh_sshfs
9594
ssh-keyscan "${OVH_HOSTNAME}" >> "${HOME}/.ssh/known_hosts"
96-
sshfs "${OVH_USERNAME}@${OVH_HOSTNAME}:/home/${OVH_USERNAME}" \
97-
/tmp/ovh_sshfs \
98-
-o ssh_command="sshpass -p ${OVH_PASSWORD} ssh" \
99-
-o kernel_cache \
100-
-o attr_timeout=600 \
101-
-o entry_timeout=600 \
102-
-o negative_timeout=600 \
103-
-o compression=no \
104-
-o PreferredAuthentications=password \
105-
-o Ciphers=aes128-gcm@openssh.com \
106-
-o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
107-
-o max_conns=4
108-
if [ ! "/tmp/ovh_sshfs/www/" = "/tmp/ovh_sshfs/www/${TARGET}" ] && [ ! -d "/tmp/ovh_sshfs/www/${TARGET}" ]; then
109-
pushd /tmp/ovh_sshfs/www
110-
find . -not \( -path './preview*' -prune \) -type d | xargs -P32 -I{} mkdir -p "./${TARGET}/{}"
111-
find . -not \( -path './preview*' -prune \) -not -type d | xargs -P32 -I{} ln -s /tmp/ovh_sshfs/www/{} "/tmp/ovh_sshfs/www/${TARGET}/{}"
112-
popd
113-
rsync --verbose --recursive --checksum --delete --delay-updates --link-dest="/tmp/ovh_sshfs/www" ./output/ "/tmp/ovh_sshfs/www/${TARGET}"
114-
else
115-
rsync --verbose --recursive --checksum --delete --delay-updates --exclude=preview ./output/ "/tmp/ovh_sshfs/www/${TARGET}"
116-
fi
117-
fusermount -u /tmp/ovh_sshfs
95+
lftp --env-password -u ${OVH_USERNAME} sftp://${OVH_HOSTNAME} \
96+
-e "set sftp:connect-program \"ssh -o Compression=no\"; set mirror:parallel-transfer-count 16; set mirror:parallel-directories yes; mirror --delete -P 16 -R ./output /home/${OVH_USERNAME}/www/${TARGET}; quit"
97+
11898
- name: Delete website
11999
if: ${{ inputs.action == 'teardown' }}
120100
env:
121101
OVH_USERNAME: ${{ secrets.OVH_USERNAME }}
122102
OVH_HOSTNAME: ${{ secrets.OVH_HOSTNAME }}
123-
OVH_PASSWORD: ${{ secrets.OVH_PASSWORD }}
103+
LFTP_PASSWORD: ${{ secrets.OVH_PASSWORD }}
124104
TARGET: ${{ inputs.target }}
125105
run: |
126106
set -exo pipefail
127107
mkdir -p ${HOME}/.ssh/
128108
mkdir -p /tmp/ovh_sshfs
109+
mkdir empty
129110
ssh-keyscan "${OVH_HOSTNAME}" >> "${HOME}/.ssh/known_hosts"
130-
sshfs "${OVH_USERNAME}@${OVH_HOSTNAME}:/home/${OVH_USERNAME}" \
131-
/tmp/ovh_sshfs \
132-
-o ssh_command="sshpass -p ${OVH_PASSWORD} ssh -o PreferredAuthentications=password" \
133-
-o max_conns=16 &
134-
rm -rf "/tmp/ovh_sshfs/www/${TARGET}"
135-
kill %1
111+
lftp --env-password -u ${OVH_USERNAME} sftp://${OVH_HOSTNAME} -e "set sftp:connect-program \"ssh -o Compression=no\"; set mirror:parallel-transfer-count 16; set mirror:parallel-directories yes; mirror --delete -P 16 -R ./empty /home/${OVH_USERNAME}/www/${TARGET}; rmdir /home/${OVH_USERNAME}/www/${TARGET}; quit"

0 commit comments

Comments
 (0)