Release_Engineering/Release_Configure
Mark Jansen 18bc5b2d3a
Some checks failed
Docker / docker (push) Failing after 20s
Add a workaround for git describe not supporting tag+count without hash
2024-09-09 14:27:44 +02:00

66 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# ReactOS Release Engineering Scripts
# Release_Configure - Set up a release configuration. First script to execute!
# Sanity checks
if [ "$ROS_ARCH" = "" ]; then
echo "Please run this script inside RosBE!"
exit 1
fi
# Constants
ORIGDIR="$PWD"
REPODIR="$PWD/Release_WorkDir/Repo"
echo "*******************************************************************************"
echo "* ReactOS Release Engineering Scripts *"
echo "*******************************************************************************"
echo
# Ask for the version
echo "What ReactOS version do you want to release? (e.g. \"0.4.12\")"
echo "This will be used as suffix for the built files."
echo "If this is an RC, just hit RETURN without entering anything to use a suffix determined by Git (e.g. \"0.4.12-RC-5-g8449527\")."
read version
echo
# Ask for the branch name
while [ "$branch_name" = "" ]; do
echo "What is the name of the Git branch? (e.g. \"releases/0.4.12\")"
read branch_name
echo
done
# Check out the Git repository
if [ -d "${REPODIR}/.git" ]; then
cd "${REPODIR}" || exit 1
git clean -d -f -f -x || exit 1
git remote set-url origin https://github.com/reactos/reactos.git || exit 1
git fetch origin || exit 1
git checkout "${branch_name}" || exit 1
git reset --hard "origin/${branch_name}" || exit 1
else
rm -rf "${REPODIR}"
git clone https://github.com/reactos/reactos.git "${REPODIR}" || exit 1
cd "${REPODIR}" || exit 1
git checkout "${branch_name}" || exit 1
fi
# Get the version from Git if none was entered.
if [ "${version}" = "" ]; then
# Output something like '0.4.15-4-ge1e96bf467b5ea'
version_with_hash=`git describe --always`
# Extract the part before the last dash to ignore the commit hash
version=${version_with_hash%-*}
fi
# Write the config file
cd "${ORIGDIR}"
echo "REPODIR=${REPODIR}" > Release_Config
echo "version=${version}" >> Release_Config
echo "branch_name=${branch_name}" >> Release_Config
# All done!
echo "Release configured!"
echo "Now you can use the other Release_* commands to create the packages."