2014-10-18 19:42:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2018-06-06 00:01:46 +00:00
|
|
|
cd "${BASH_SOURCE%/*}/.."
|
2017-09-04 18:43:26 +00:00
|
|
|
tag=$(git describe --exact-match --match '*-cli*') || { echo >&2 "Tree is not at a release tag."; exit 1; }
|
|
|
|
version=$(git describe --match '*-cli*' --long --dirty --broken)
|
|
|
|
[[ $version != *-dirty ]] || { echo >&2 "Tree is dirty, first commit any changes."; exit 1; }
|
2014-10-18 19:56:31 +00:00
|
|
|
|
2017-09-04 18:43:26 +00:00
|
|
|
mpwArchive=mpw-$version.tar.gz
|
2017-04-06 19:04:15 +00:00
|
|
|
[[ -e $mpwArchive ]] && echo >&2 "WARNING: $mpwArchive already exists. Will overwrite."
|
2014-10-18 19:42:49 +00:00
|
|
|
read -n1 -p "Will prepare and release $mpwArchive. Press a key to continue or ^C to abort."
|
|
|
|
|
2017-04-22 15:15:07 +00:00
|
|
|
echo "Cleaning .."
|
2018-06-06 00:01:46 +00:00
|
|
|
git clean -ffdx .
|
2017-04-22 15:15:07 +00:00
|
|
|
|
2017-04-06 19:04:15 +00:00
|
|
|
echo "Creating archive $mpwArchive .."
|
2021-02-18 15:15:40 +00:00
|
|
|
echo "$version" > cli/VERSION
|
|
|
|
git show --show-signature --pretty=format:%H --quiet "$tag" > cli/TAG
|
|
|
|
{ git ls-files -z .; printf '%s\0' cli/VERSION cli/TAG; } | xargs -0 tar -Lcvzf "$mpwArchive"
|
2017-04-22 15:15:07 +00:00
|
|
|
|
2017-04-06 19:04:15 +00:00
|
|
|
echo "Creating archive signature $mpwArchive.sig .."
|
2018-04-22 12:54:25 +00:00
|
|
|
gpg --detach-sign --local-user 5C2D1D61853F20F2FCDDCCB70EF21226F43EA6BC "$mpwArchive"
|
2014-10-18 19:42:49 +00:00
|
|
|
|
2018-04-22 12:54:25 +00:00
|
|
|
echo "Installing archive and signature in site .."
|
|
|
|
cd ../../public/site
|
|
|
|
mv "$OLDPWD/$mpwArchive" .; [[ -e $_ ]]
|
|
|
|
mv "$OLDPWD/$mpwArchive.sig" .; [[ -e $_ ]]
|
2017-04-06 14:14:13 +00:00
|
|
|
ln -sf "$mpwArchive" "masterpassword-cli.tar.gz"; [[ -e $_ ]]
|
2017-04-06 19:04:15 +00:00
|
|
|
ln -sf "$mpwArchive.sig" "masterpassword-cli.tar.gz.sig"; [[ -e $_ ]]
|
|
|
|
|
|
|
|
echo
|
2017-04-22 16:30:07 +00:00
|
|
|
echo "Done. Ready to publish the site."
|
|
|
|
echo " package: $mpwArchive"
|
|
|
|
echo " signature: $mpwArchive.sig"
|
2018-06-03 20:26:08 +00:00
|
|
|
echo " url: https://masterpassword.app/$mpwArchive"
|