#!/usr/bin/env bash # # Usage: # ./publish.sh set -o nounset set -o pipefail set -o errexit proc log { echo @Argv !1 > !2 } proc versioned-dest { local branch=$[git rev-parse --abbrev-ref HEAD] log "branch $branch" local hash=$[git rev-parse $branch] local short_hash=$(hash:0:8) log "hash $short_hash" local dest="oilshell.org/git-branch/$branch/$short_hash" echo $dest } proc spec { local user=$1 local host=$2 # Add hostname because spec tests aren't hermetic yet. local dest setglobal dest = ""$[versioned-dest]/$[hostname]/spec"" ssh $user@$host mkdir -p $dest # rsync is faster than scp and has the --no-target-directory behavior. # We need --copy-links because the CSS files are symlinks. rsync --archive --verbose --copy-links \ _tmp/spec/ $user@$host:$dest/ echo "Visit http://$dest/RESULTS.html" } # TODO: These should really go to the oilshell.org__deploy repo. # Publish unit tests proc unit { echo 'Hello from publish.sh' } # NOTE: Have to copy the web/ dir too? For testing, use ./local.sh # test-release-tree. proc wild { local user=$1 local host=$2 local dest setglobal dest = $[versioned-dest] # no wild/ suffix, since it's wild.wwz/ ssh $user@$host mkdir -p $dest rsync --archive --verbose \ _release/VERSION/test/wild.wwz $user@$host:$dest/ echo "Visit http://$dest/wild.wwz/" } @Argv