Skip to content

Consolidate release script #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN wget https://downloads.sourceforge.net/reactos/RosBE-Unix-2.2.1.tar.bz2 \
&& rm -rf RosBE-Unix-2.2.1

RUN git clone https://github.com/reactos/Release_Engineering \
&& mv Release_Engineering/Release_* /usr/local/bin \
&& mv Release_Engineering/Scripts/* /usr/local/bin \
&& rm -rf Release_Engineering

CMD ["/usr/local/RosBE/RosBE.sh", "/work"]
9 changes: 9 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ Below steps outline the process of running it locally.

## Building a release

### *Using the new release script*
```bash
git clone https://github.com/reactos/reactos.git
cd reactos
git checkout releases/0.4.15
release
```

### *Using the old release script*
```bash
Release_Configure
# Answer the prompts
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
128 changes: 128 additions & 0 deletions Scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/bin/bash

# Constants
ROOTDIR="$PWD"
OPTMODDIR="modules/optional"
OUTPUTDIR="output-MinGW-i386"

echo "*******************************************************************************"
echo "* ReactOS Release Script *"
echo "*******************************************************************************"
echo

# Ensure we are in RosBE.
if [ "$ROS_ARCH" = "" ]; then
echo "Please run this script inside RosBE!"
exit 1
fi

# Ensure this is running inside a git directory.
if [ ! -d "${ROOTDIR}/.git" ]; then
echo "Please run this script inside a ReactOS git directory. Release aborted."
exit 1
fi

# Check for internet connection.
wget -q --spider https://reactos.org

if [ $? -eq 0 ]; then
internet=true
else
echo "Warning! No internet connection detected."
echo "Optional modules cannot be downloaded and origin cannot be fetched."
echo
fi

# Get version (ex: 0.4.15-4-ge1e96bf467b5ea).
version=$(git describe)
# Remove git hash at end of the version.
version=${version%-*}
# Change "release" to "rls", if it is in the version name.
version=${version/release/rls}
# Get the branch name.
branch_name=$(git rev-parse --abbrev-ref HEAD)

echo "ReactOS version is ${version}"
echo "ReactOS branch name is ${branch_name}"
echo

# Ensure version and branch name are not null.
if [ "$version" = "" ] || [ "$branch_name" = "" ]; then
echo "Version or branch name is NULL! Release aborted."
exit 1
fi

# Clean repository, excluding the modules/optional folder and its contents.
git clean -d -f -f -x --exclude="/modules/optional/*" || exit 1
# Fetch changes from origin if we have an internet connection.
if [ "$internet" ]; then
git fetch origin || exit 1
fi
# Reset to the head of the branch
git reset --hard HEAD || exit 1
echo

# Download the "optional" folder from svn.reactos.org if it isn't already downloaded.
# Ensure the optional modules folder is there and contains the modules we need.
if [ -d "${OPTMODDIR}" ] && [ -f "${OPTMODDIR}/DroidSansFallback.ttf" ] && compgen -G "${OPTMODDIR}/wine_gecko*.msi" > /dev/null; then
echo "Optional modules already downloaded. Skipping."
echo "If you have an issue with the optional modules, re-run this script after deleting the directory:"
echo " ${ROOTDIR}/${OPTMODDIR}"
elif [ "${internet}" ]; then
echo "Downloading optional modules..."
if [ -d "${OPTMODDIR}" ]; then
rm -rf "${OPTMODDIR}" || exit 1
fi
mkdir "${OPTMODDIR}" || exit 1
cd "${OPTMODDIR}" || exit 1
wget --recursive --level=1 --no-directories --no-parent --execute robots=off "https://svn.reactos.org/optional" || exit 1
# Check that all mandatory files were downloaded.
if [ ! -f "DroidSansFallback.ttf" ]; then
echo "DroidSansFallback CJK font missing!"
exit 1
fi
if ! compgen -G "wine_gecko*.msi" > /dev/null; then
echo "wine_gecko MSI package missing!"
exit 1
fi
else
echo "Missing optional modules and no internet connection. Release aborted."
exit 1
fi
echo

# BootCD and LiveCD deliverable constants
BOOTCDISO="ReactOS-${version}-${ROS_ARCH}-boot.iso"
BOOTCDZIP="ReactOS-${version}-${ROS_ARCH}-boot.zip"
LIVECDISO="ReactOS-${version}-${ROS_ARCH}-live.iso"
LIVECDZIP="ReactOS-${version}-${ROS_ARCH}-live.zip"
EXPORTDIR="ReactOS-${version}"
SOURCEZIP="ReactOS-${version}-src.zip"

# Build ReactOS
cd "${ROOTDIR}" || exit 1
./configure.sh -DENABLE_ROSAPPS=1 -DENABLE_WALLPAPERS=1 || exit 1
cd "${OUTPUTDIR}" || exit 1
ninja bootcd || exit 1
ninja livecd || exit 1

# Create the ZIP packages for BootCD and LiveCD
echo "Creating BootCD and LiveCD ZIP packages..."
mv "bootcd.iso" "${BOOTCDISO}" || exit 1
zip -9 "${ROOTDIR}/${BOOTCDZIP}" "${BOOTCDISO}" || exit 1
mv "livecd.iso" "${LIVECDISO}" || exit 1
zip -9 "${ROOTDIR}/${LIVECDZIP}" "${LIVECDISO}" || exit 1

# Create the ZIP package for the source deliverable
echo "Creating source ZIP package..."
cd "${ROOTDIR}"
git archive --format=zip --prefix="${EXPORTDIR}/" -9 --output="${ROOTDIR}/${SOURCEZIP}" "${branch_name}" || exit 1

# We're done!
echo
echo "*******************************************************************************"
echo "Successfully created the following packages:"
echo " ${ROOTDIR}/${BOOTCDZIP}"
echo " ${ROOTDIR}/${LIVECDZIP}"
echo " ${ROOTDIR}/${SOURCEZIP}"
echo "*******************************************************************************"