Skip to content

Commit

Permalink
Update symlinks on server to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
th-otto committed Apr 29, 2024
1 parent 519e232 commit 12518e8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh -x

[email protected]:/home/www/snapshots
[email protected]
UPLOAD_DIR=$SERVER:/home/www/snapshots

if [ -z "${DEPLOY_ARCHIVE+x}" ]
then
Expand Down Expand Up @@ -49,12 +50,24 @@ upload_file() {
exit 1
}

link_file() {
local from="$1"
local to="$2"
for i in 1 2 3
do
ssh -o "StrictHostKeyChecking no" $SERVER -- "cd www/snapshots/${PROJECT_DIR}; ln -sf $from $to"
[ $? = 0 ] && return 0
sleep 1
done
exit 1
}

for f in "" -000 -020 -v4e; do
upload_file "${DEPLOY_DIR}/${ARCHIVE_NAME}${f}.${DEPLOY_ARCHIVE}" "${UPLOAD_DIR}/${PROJECT_DIR}/${ARCHIVE_NAME}${f}.${DEPLOY_ARCHIVE}"
done
if test -z "${CPU_TARGET}"
then
upload_file "$ARCHIVE_PATH" "${UPLOAD_DIR}/${PROJECT_DIR}/${PROJECT_DIR}-latest.${DEPLOY_ARCHIVE}"
link_file "${ARCHIVE_NAME}.${DEPLOY_ARCHIVE}" "${PROJECT_DIR}-latest.${DEPLOY_ARCHIVE}"
fi

echo ${PROJECT_NAME}-${PROJECT_VERSION}-${SHORT_ID} > .latest_version
Expand Down

0 comments on commit 12518e8

Please sign in to comment.