69 lines
2.0 KiB
Bash
Executable File
69 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
VERSION=1.98.1
|
|
|
|
REPO_DIR="n8n-$VERSION"
|
|
|
|
if [ -d "$REPO_DIR" ]; then
|
|
echo "---- Removing old directory of $VERSION ----"
|
|
rm -Rf $REPO_DIR
|
|
fi
|
|
|
|
echo "---- Cloning n8n for version $VERSION ----"
|
|
git -c advice.detachedHead=false clone --depth 1 --branch "n8n@$VERSION" --single-branch https://github.com/n8n-io/n8n.git $REPO_DIR
|
|
|
|
echo "---- Verifying patches for $VERSION ----"
|
|
cd $REPO_DIR
|
|
|
|
PATCH_VERSION=$VERSION
|
|
|
|
if [ ! -d "../patches/$PATCH_VERSION/" ]; then
|
|
echo " Direct patches for $PATCH_VERSION couldn't be found trying default patches"
|
|
PATCH_VERSION="default"
|
|
fi
|
|
|
|
has_patch_error=0
|
|
for patch_filename in ../patches/$PATCH_VERSION/*.patch; do
|
|
git apply --check $patch_filename;
|
|
if [ $? -eq 0 ]; then
|
|
echo " - Dryrun for \"$patch_filename\" successful"
|
|
else
|
|
echo " - Dryrun for \"$patch_filename\" was unsuccessful, please check the patch file"
|
|
has_patch_error=1
|
|
fi
|
|
done
|
|
|
|
if [ $has_patch_error -ne 0 ]; then
|
|
echo " Found error while patching. Exiting"
|
|
exit 1
|
|
fi
|
|
|
|
for patch_filename in ../patches/$PATCH_VERSION/*.patch; do
|
|
echo " - Applying \"$patch_filename\""
|
|
git apply --whitespace=nowarn $patch_filename;
|
|
done
|
|
|
|
|
|
echo "---- Building base image for $VERSION ----"
|
|
|
|
docker image rm n8n-license-patched-base:22 2>/dev/null
|
|
docker build -t n8n-license-patched-base:22 -f docker/images/n8n-base/Dockerfile .
|
|
if [ $? -ne 0 ]; then
|
|
echo "Build unsuccessful. Exiting"
|
|
fi
|
|
|
|
echo "---- Patching and building main image for $VERSION ----"
|
|
|
|
sed -i 's/n8nio\/base/n8n-license-patched-base/g' docker/images/n8n/Dockerfile
|
|
if [ $? -ne 0 ]; then
|
|
echo "Base image tag patch unsuccessful. Exiting"
|
|
fi
|
|
|
|
docker image rm n8n-license-patched:$VERSION 2>/dev/null
|
|
docker build -t n8n-license-patched:$VERSION -f docker/images/n8n/Dockerfile .
|
|
if [ $? -ne 0 ]; then
|
|
echo "Build unsuccessful. Exiting"
|
|
fi
|
|
|
|
docker tag n8n-license-patched:$VERSION git.dev.internal.tugler.fr/samuel.tugler/n8n-license-patch:$VERSION
|
|
docker push git.dev.internal.tugler.fr/samuel.tugler/n8n-license-patched:$VERSION
|