#!/bin/bash
# dev/package/release - Package Releases
set -e
lib_load 'dev/package/publish'
lib_load 'dev/tool/make'
######
# Package Release Wizard
# package_release_wizard() - The Package Release Wizard performs all
# of the steps required to create, upload, and publish a release.
# $1 - Release type (major, minor, micro)
#
# This function performs the following individual steps:
package_release_wizard() {
# - Creates the distribution files for a new release.
package_release_create
# - Publishes all of the pieces for the release to their
# appropriate locations and updates the release branch links.
package_publish_upload
# - Finalizes the release files, uploads, and versions.
package_release_finish "$@"
}
# package_release_create() - Automates the entire package release process
# for the given type of release ($1).
#
# This function performs the following individual steps:
package_release_create() {
has_args 0 "$@"
# - Pulls changes from the remote repository.
git_update
# - Removes the existing development installation. For this
# reason, we **strongly recommend** using a virgin clone of the
# repository that has been dedicated to the release process.
run rm -rf $package_repodir/install
# - Bootstraps the package to produce the local ``install/`` tree.
run $package_repodir/bootstrap.sh
# - Removes all build artifacts except the ``install/`` tree.
make_run dist-clean
# - Modifies the ``system.i7`` file to enable `release` mode.
local var='RELEASE_TYPE'
run sed -i -e "s,^$var=debug,$var=release," "${system_i7}"
RELEASE_TYPE=release
# - Builds the release files and tags the repo.
make_run dist-all
}
# package_release_finish() - Finishes the release process.
# $1 - Release branch
#
# This function performs the following individual steps:
package_release_finish() {
has_args 1 "$@"
local release_type=$1
# - Finalizes the published files
package_publish_finish
# - Locks the release files
package_release_lock
# - Tags the release revision in the repository
package_version_tag
# - Bumps the package version to start the next release cycle
package_version_bump "$release_type"
}
# package_release_ready() - Returns success if the package is ready
# for a release.
package_release_ready() {
lib_load 'dev/package/check'
local flag
flag=$(package_check_flag_file)
[ -f "$flag" ] || return 1
local rev_checked
rev_checked=$(cat "$flag")
local rev_current
rev_current=$(git_rev_parse HEAD)
[ "$rev_current" = "$rev_checked" ]
}
# package_release_chmod() - Changes the mode of distribution files
# $1 - File mode
# $2 - Directory mode
# $3 - Release version (optional)
package_release_chmod() {
local version
version=${3:-$(package_version_read_full)}
run chmod $1 dist/${PKG}-$version/*
run chmod $2 dist/${PKG}-$version
}
# package_release_lock() - Prevents release files from being updated or deleted.
# $1 - Release version (optional)
package_release_lock() { package_release_chmod 444 555 "$@"; }
# package_release_unlock() - Allows release files to be updated or deleted.
# $1 - Release version (optional)
package_release_unlock() { package_release_chmod 644 755 "$@"; }
# package_release_undo() - Removes all artifacts of a failed release.
#
# This function performs the following individual steps:
package_release_undo() {
has_args 0 "$@"
# - Reverts the bump to the package version
package_version_unbump || true
# - Deletes the release tag
package_version_untag || true
# - Unlocks the release distribution files
package_release_unlock || true
# - Unlocks the published files
package_publish_unlock || true
}
Generated on Fri Jul 28 14:35:28 PDT 2017 by mcsh d14 v0.23.0.