qortal/tools/build-zip.sh
CalDescent d6e65a3d63 Removed version number from qortal.exe and qortal.zip
Recently we have stopped including the version number in the zip and exe files uploaded to github, as this allows us to use the "https://github.com/Qortal/*/releases/latest/download/*" redirect for all 3 files when linking from the qortal.org website. Previously, it could only be done for the JAR since this was the only file that didn't contain a version number. This avoids having to update the website every time we distribute a new release.

Note that this currently requires that the Qortal-x.y.z.exe file created by AdvancedInstaller is renamed to qortal.exe before running ./build-release.sh. If you forget to rename, the script will exit with a warning that the file couldn't be found.
2021-07-18 10:36:04 +01:00

67 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# Optional git tag?
if [ $# -ge 1 ]; then
git_tag="$1"
shift
fi
saved_pwd=$PWD
# Check we are within a git repo
git_dir=$( git rev-parse --show-toplevel )
if [ -z "${git_dir}" ]; then
echo "Cannot determine top-level directory for git repo"
exit 1
fi
# Change to git top-level
cd ${git_dir}
# Check we are in 'master' branch
# branch_name=$( git symbolic-ref -q HEAD ) || echo "Cannot determine branch name" && exit 1
# branch_name=${branch_name##refs/heads/}
# echo "Current git branch: ${branch_name}"
# if [ "${branch_name}" != "master" ]; then
# echo "Unexpected current branch '${branch_name}' - expecting 'master'"
# exit 1
# fi
# Determine project name
project=$( perl -n -e 'if (m/<artifactId>(\w+)<.artifactId>/) { print $1; exit }' pom.xml $)
if [ -z "${project}" ]; then
echo "Unable to determine project name from pom.xml?"
exit 1
fi
# Extract git tag
if [ -z "${git_tag}" ]; then
git_tag=$( git tag --points-at HEAD )
if [ -z "${git_tag}" ]; then
echo "Unable to extract git tag"
exit 1
fi
fi
build_dir=/tmp/${project}
commit_ts=$( git show --no-patch --format=%cI )
/bin/rm -fr ${build_dir}
mkdir -p ${build_dir}
cp target/${project}*.jar ${build_dir}/${project}.jar
git show HEAD:log4j2.properties > ${build_dir}/log4j2.properties
git show HEAD:start.sh > ${build_dir}/start.sh
git show HEAD:stop.sh > ${build_dir}/stop.sh
printf "{\n}\n" > ${build_dir}/settings.json
gtouch -d ${commit_ts%%+??:??} ${build_dir} ${build_dir}/*
rm -f ${saved_pwd}/${project}.zip
(cd ${build_dir}/..; 7z a -r -tzip ${saved_pwd}/${project}.zip ${project}/)