Pull request: scripts: make frontend archives as well

Updates #2958.
Updates #2959.

Squashed commit of the following:

commit 0779cc941dae8cfbedb3731dc1c6177c7590a182
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Apr 30 21:22:26 2021 +0300

    scripts: make frontend archives as well
This commit is contained in:
Ainar Garipov 2021-05-04 16:07:59 +03:00
parent 1402145cdd
commit c4223224f5
1 changed files with 13 additions and 6 deletions

View File

@ -50,7 +50,7 @@ readonly channel="$CHANNEL"
# that, use the version calculation script. # that, use the version calculation script.
if [ "${VERSION:-}" = 'v0.0.0' ] || [ "${VERSION:-}" = '' ] if [ "${VERSION:-}" = 'v0.0.0' ] || [ "${VERSION:-}" = '' ]
then then
readonly version="$(sh ./scripts/make/version.sh)" readonly version="$( sh ./scripts/make/version.sh )"
else else
readonly version="$VERSION" readonly version="$VERSION"
fi fi
@ -207,13 +207,14 @@ build() {
case "$build_os" case "$build_os"
in in
('darwin'|'windows') ('darwin'|'windows')
build_archive="${PWD}/${dist}/${build_ar}.zip" build_archive="./${dist}/${build_ar}.zip"
( cd "${dist}/${1}" && zip -9 -q -r "$build_archive" "./AdGuardHome" ) # TODO(a.garipov): Find an option similar to the -C option of
# tar for zip.
( cd "${dist}/${1}" && zip -9 -q -r "../../${build_archive}" "./AdGuardHome" )
;; ;;
(*) (*)
build_archive="./${dist}/${build_ar}.tar.gz" build_archive="./${dist}/${build_ar}.tar.gz"
tar -C "./${dist}/${1}" -c -f - "./AdGuardHome"\ tar -C "./${dist}/${1}" -c -f - "./AdGuardHome" | gzip -9 - > "$build_archive"
| gzip -9 - >"$build_archive"
;; ;;
esac esac
@ -324,6 +325,12 @@ do
build "$dir" "$ar" "$os" "$arch" "$arm" "$mips" "$snap" build "$dir" "$ar" "$os" "$arch" "$arm" "$mips" "$snap"
done done
log "packing frontend"
build_archive="./${dist}/AdGuardHome_frontend.tar.gz"
tar -c -f - ./build ./build2 | gzip -9 - > "$build_archive"
log "$build_archive"
log "calculating checksums" log "calculating checksums"
# Calculate the checksums of the files in a subshell with a different # Calculate the checksums of the files in a subshell with a different
@ -383,7 +390,7 @@ echo "
readonly ar_files="$( \ readonly ar_files="$( \
find "./${dist}/" ! -name "${dist}" -prune \( -name '*.tar.gz' -o -name '*.zip' \) find "./${dist}/" ! -name "${dist}" -prune \( -name '*.tar.gz' -o -name '*.zip' \)
)" )"
readonly ar_files_len="$(echo "$ar_files" | wc -l)" readonly ar_files_len="$( echo "$ar_files" | wc -l )"
i='1' i='1'
# Don't use quotes to get word splitting. # Don't use quotes to get word splitting.