#!/bin/bash
# dev/package/publish - Package Release Publishing
set -e
lib_load 'dev/package/install'
######
# SSH Publishing Support
# package_publish_ssh() - Publishes files using ``rsync`` via SSH.
# This remote host and pat are specified by the ``$PUBLISH_SSH_HOST``
# and ``$PUBLISH_SSH_PATH`` settings in the package configuration files.
# $1 - Source path
# $2 - Destination path
package_publish_ssh() {
local src=$1
local dst=$2
local host=$PUBLISH_SSH_HOST
local path=$PUBLISH_SSH_PATH
if [ -z "$host" -o -z "$path" ]; then
warn "ssh transport: host/path not definied, skipping $dst..."
return
fi
rsync_run -a "$src" "$host:$path/$dst"
}
######
# Distribution Files Publishing
# package_publish_tarballs() - Publishes distribution tarballs for the
# given package version ($1).
# $1 - Package version
package_publish_tarballs() {
local version=${1:-$(package_version_build_full)}
local dirname
dirname=$(package_dist_dirname '' "$version")
app_echo "publishing v$version release tarballs..."
package_publish_ssh "$package_distdir/$dirname" releases
}
######
# Documentation Publishing
# package_publish_docs() - Publishes documentation for the given package
# version ($1).
# $1 - Package version
package_publish_docs() {
local version=${1:-$(package_version_build_full)}
local dirname
dirname=$(package_dist_dirname docs "$version")
app_echo "publishing v$version documentation..."
package_publish_ssh "$package_objdir/$dirname" docs
}
######
# Installer Publishing
# package_publish_installers() - Publishes installers for the given package
# version ($1).
# $1 - Package version
package_publish_installers() {
local version=${1:-$(package_version_build_full)}
package_publish_installer_kind 'local' "$version"
package_publish_installer_kind 'net' "$version"
package_publish_installer_kind 'complete' "$version"
}
package_publish_installer_kind() {
local kind=$1
local version=$2
app_echo "generating v$version $kind installer..."
local tmp
tmp=$(cmd_tempfile)
package_install_script_$kind "$version" >"$tmp"
run chmod 0444 "$tmp"
local dirname
dirname=$(package_dist_dirname '' "$version")
app_echo "publishing v$version $kind installer..."
local installer="releases/$dirname/${dirname}-${kind}-install.sh"
package_publish_ssh "$tmp" "$installer"
}
######
# Current Link Publishing
package_publish_links() {
package_publish_links_dir releases "$@"
package_publish_links_dir docs "$@"
}
package_publish_links_dir() {
local dir=$1
local version=${2:-$(package_version_build_full)}
local tmp
tmp=$(cmd_tempfile)
local ext
case "$dir" in
(releases) ext='' ;;
(docs) ext='docs' ;;
(*) error "$dir: unknown link publishing directory"
esac
local branch=$RELEASE_BRANCH
package_release_branch_required "$branch"
app_echo "generating symbolic link to v$version for $branch $dir..."
local dirname
dirname=$(package_dist_dirname "$ext" "$version")
run ln -sf "$dirname" "$tmp"
app_echo "publishing new $branch $dir link..."
package_publish_ssh "$tmp" "$dir/current-$branch"
}
######
# Announcement Publishing
package_publish_announce() { warn "unimplemented"; }
Generated on Thu May 4 18:59:49 PDT 2017 by mcsh i7 v0.19.0.