2022-02-14 09:26:18 +00:00
|
|
|
#!/dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::// deploy / ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
--:: deploy / rsync / * / linux / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' linux--x86_64 "${@}"
|
|
|
|
--:: deploy / rsync / * / darwin / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' darwin--x86_64 "${@}"
|
|
|
|
--:: deploy / rsync / * / darwin / aarch64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' darwin--aarch64 "${@}"
|
|
|
|
--:: deploy / rsync / * / freebsd / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' freebsd--x86_64 "${@}"
|
|
|
|
--:: deploy / rsync / * / openbsd / x86_64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' openbsd--x86_64 "${@}"
|
|
|
|
--:: deploy / rsync / * / android / aarch64 :: exec -- "${ZRUN[@]}" ':: deploy / rsync / *' android--aarch64 "${@}"
|
2022-02-14 09:26:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<< deploy / rsync / *
|
|
|
|
test "${#}" -eq 3 ; _os="${1}" ; _main="${2}" ; _target="${3}" ; shift -- 3
|
|
|
|
"${ZRUN[@]}" ':: deploy / release' "${_os}" "${_main}"
|
2022-09-02 08:38:22 +00:00
|
|
|
_source="./.outputs/binaries/publish/${_main}--${_os}"
|
2022-02-14 09:26:18 +00:00
|
|
|
printf -- '[ii] deploying `%s` for `%s` to `%s`...\n' "${_main}" "${_os}" "${_target}" >&2
|
|
|
|
exec -- rsync -i -t -p --chmod=0555 -- "${_source}" "${_target}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
<< deploy / publish / no-github
|
|
|
|
export -- __DEPLOY_NOGITHUB=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: deploy / publish' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2022-02-14 09:26:18 +00:00
|
|
|
<< deploy / publish
|
|
|
|
|
|
|
|
if test "${#}" -eq 0 ; then
|
|
|
|
_main_0=all
|
|
|
|
else
|
|
|
|
_main_0="${1}"
|
|
|
|
shift -- 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
test "${#}" -eq 0
|
|
|
|
|
|
|
|
test -d ./.publish/
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
if test "${__DEPLOY_NOGITHUB:-}" == true ; then
|
|
|
|
_github_publish=false
|
|
|
|
else
|
|
|
|
_github_publish=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2022-08-26 16:02:41 +00:00
|
|
|
_build_version="${__BUILD_VERSION}"
|
2022-02-14 09:26:18 +00:00
|
|
|
case "${_build_version}" in
|
|
|
|
( 0.0.0 | *.0 )
|
|
|
|
_build_release=false
|
|
|
|
_build_suffix='--preview'
|
|
|
|
;;
|
|
|
|
( * )
|
|
|
|
_build_release=true
|
|
|
|
_build_suffix=''
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
if test "${_build_release}" == true ; then
|
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-02 08:38:22 +00:00
|
|
|
for _os in linux--x86_64 darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
|
2022-02-14 09:26:18 +00:00
|
|
|
if test -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" ; then
|
|
|
|
printf -- '[ee] release already exists for `%s` for `%s`!\n' "${_main}" "${_os}" >&2
|
|
|
|
exit -- 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
if test "${_github_publish}" == true ; then
|
|
|
|
if ! git diff --quiet ; then
|
|
|
|
printf -- '[ee] dirty repository (before build); aborting!\n' >&2
|
|
|
|
exit -- 1
|
|
|
|
fi
|
|
|
|
if ! git diff --cached --quiet ; then
|
|
|
|
printf -- '[ee] dirty repository (before build); aborting!\n' >&2
|
|
|
|
exit -- 1
|
|
|
|
fi
|
2022-02-14 09:26:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
printf -- '[ii] releasing all for `%s`...\n' "${_build_version}${_build_suffix}" >&2
|
|
|
|
|
|
|
|
"${ZRUN[@]}" ':: deploy / release' all "${_main_0}"
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
if test "${_github_publish}" == true ; then
|
|
|
|
|
|
|
|
if ! git diff --quiet ; then
|
|
|
|
printf -- '[ee] dirty repository (after build); aborting!\n' >&2
|
|
|
|
exit -- 1
|
|
|
|
fi
|
|
|
|
if ! git diff --cached --quiet ; then
|
|
|
|
printf -- '[ee] dirty repository (after build); aborting!\n' >&2
|
|
|
|
exit -- 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf -- '[ii] tagging and pushing for `%s`...\n' "${_build_version}${_build_suffix}" >&2
|
|
|
|
printf -- '[--]\n' >&2
|
|
|
|
|
|
|
|
if test "${_build_release}" == true ; then
|
|
|
|
git tag --sign -m "[release] Release \`v${_build_version}\`." -- "v${_build_version}" HEAD
|
|
|
|
else
|
|
|
|
git tag --sign -m "[preview] Preview \`v${_build_version}\`." --force -- preview HEAD
|
|
|
|
fi
|
|
|
|
|
|
|
|
"${ZRUN[@]}" ':: github / push'
|
|
|
|
|
|
|
|
printf -- '[--]\n' >&2
|
2022-02-14 09:26:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
printf -- '[ii] publishing all for `%s`...\n' "${_build_version}${_build_suffix}" >&2
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
for _os in linux--x86_64 darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
|
2022-02-14 09:26:18 +00:00
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
|
|
|
|
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf -- '[ii] publishing `%s` for `%s` for `%s`...\n' "${_main}" "${_os}" "${_build_version}${_build_suffix}" >&2
|
|
|
|
printf -- '[--]\n' >&2
|
|
|
|
|
|
|
|
rsync -i -t -p --chmod=0555 -- \
|
2022-09-02 08:38:22 +00:00
|
|
|
"./.outputs/binaries/publish/${_main}--${_os}" \
|
2022-02-14 09:26:18 +00:00
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
|
|
|
|
#
|
|
|
|
|
|
|
|
if test -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" ; then
|
|
|
|
if ! gpg2 --verify -- \
|
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
|
|
|
|
< /dev/null > /dev/null 2> /dev/null \
|
|
|
|
; then
|
|
|
|
rm -- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test ! -e "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" ; then
|
|
|
|
for _retry in 1 2 3 4 ; do
|
|
|
|
if gpg2 --sign --detach-sign --armor \
|
|
|
|
--default-key 58FC2194FCC2478399CB220C5A974037A6FD8839 \
|
|
|
|
--output "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
|
|
|
|
-- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
|
|
|
|
; then break ; fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
gpg2 --verify \
|
|
|
|
-- "./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
|
|
|
|
#
|
|
|
|
|
|
|
|
if test "${_build_release}" == true ; then
|
|
|
|
ln -s -T -f -- "./${_main}--${_os}--v${_build_version}${_build_suffix}" "./.publish/${_os}/${_main}${_build_suffix}"
|
|
|
|
ln -s -T -f -- "./${_main}--${_os}--v${_build_version}${_build_suffix}.asc" "./.publish/${_os}/${_main}${_build_suffix}.asc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf -- '[--]\n' >&2
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
if test "${_github_publish}" == true ; then
|
|
|
|
|
|
|
|
printf -- '[ii] publishing all for `%s` (on GitHub)...\n' "${_build_version}${_build_suffix}" >&2
|
|
|
|
|
|
|
|
for _os in linux--x86_64 darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
|
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
|
|
|
|
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf -- '[ii] publishing `%s` for `%s` for `%s` (on GitHub)...\n' "${_main}" "${_os}" "${_build_version}${_build_suffix}" >&2
|
|
|
|
|
|
|
|
if test "${_build_release}" == true ; then
|
|
|
|
gh release upload --clobber -- "v${_build_version}" \
|
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
|
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
|
|
|
|
#
|
|
|
|
else
|
|
|
|
gh release upload --clobber -- preview \
|
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}" \
|
|
|
|
"./.publish/${_os}/${_main}--${_os}--v${_build_version}${_build_suffix}.asc" \
|
|
|
|
#
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
2022-02-14 09:26:18 +00:00
|
|
|
done
|
2022-09-02 08:38:22 +00:00
|
|
|
fi
|
2022-02-14 09:26:18 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< deploy / release
|
|
|
|
if test "${#}" -ge 1 ; then
|
|
|
|
_os_0="${1}"
|
|
|
|
shift -- 1
|
|
|
|
else
|
|
|
|
_os_0='all'
|
|
|
|
fi
|
|
|
|
if test "${#}" -ge 1 ; then
|
|
|
|
_main_0="${1}"
|
|
|
|
shift -- 1
|
|
|
|
else
|
|
|
|
_main_0=all
|
|
|
|
fi
|
|
|
|
test "${#}" -eq 0
|
|
|
|
if test "${__DEPLOY_NORELEASE:-}" == true ; then
|
|
|
|
exit -- 0
|
|
|
|
fi
|
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
if test "${_main_0}" != all -a "${_main_0}" != "${_main}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-02 08:38:22 +00:00
|
|
|
for _os in linux--x86_64 darwin--x86_64 darwin--aarch64 freebsd--x86_64 openbsd--x86_64 android--aarch64 ; do
|
2022-02-14 09:26:18 +00:00
|
|
|
if test "${_os_0}" != all -a "${_os_0}" != "${_os}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-02 08:38:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / build / all / publish' "${_os}" "${_main#kawipiko-}"
|
2022-02-14 09:26:18 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
!!
|
|
|
|
|