ZigBrains/build.sh

87 lines
1.9 KiB
Bash
Raw Permalink Normal View History

2024-11-07 15:26:00 +01:00
#!/bin/sh
#
2025-02-06 01:14:51 +01:00
# This file is part of ZigBrains.
2024-11-07 15:26:00 +01:00
#
2025-02-06 01:14:51 +01:00
# Copyright (C) 2023-2025 FalsePattern
# All Rights Reserved
2024-11-07 15:26:00 +01:00
#
2025-02-06 01:14:51 +01:00
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
2024-11-07 15:26:00 +01:00
#
2025-02-06 01:14:51 +01:00
# ZigBrains is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, only version 3 of the License.
#
# ZigBrains is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
2024-11-07 15:26:00 +01:00
#
set -e
2025-04-17 09:44:51 +02:00
declare -a branches=("master" "243" "242" "241")
2024-11-07 15:26:00 +01:00
DEFAULT_BRANCH="${branches[0]}"
if [[ -z "${PRIVATE_KEY_PASSWORD}" ]]; then
echo "PRIVATE_KEY_PASSWORD missing!"
exit 1
fi
if [[ -z "${MAVEN_DEPLOY_USER}" ]]; then
echo "MAVEN_DEPLOY_USER missing!"
exit 1
fi
if [[ -z "${MAVEN_DEPLOY_PASSWORD}" ]]; then
echo "MAVEN_DEPLOY_PASSWORD missing!"
exit 1
fi
if [[ -z "${IJ_PUBLISH_TOKEN}" ]]; then
echo "IJ_PUBLISH_TOKEN missing!"
exit 1
fi
if [ ! -f secrets/chain.crt ]; then
echo "secrets/chain.crt missing!"
exit 1
fi
if [ ! -f secrets/private.pem ]; then
echo "secrets/private.pem missing!"
exit 1
fi
git checkout "$DEFAULT_BRANCH" && ./gradlew clean
RESULT=$?
if [ $RESULT != 0 ]; then
echo "Failed to clean!"
exit 1
fi
for i in "${branches[@]}"
do
echo "Building branch $i"
git checkout "$i" && ./gradlew verifyPluginSignature
RESULT=$?
if [ $RESULT != 0 ]; then
echo "Failed to build plugin on branch $i!"
exit 1
fi
done
git checkout "$DEFAULT_BRANCH"
mkdir -p build/dist
cp build/distributions/*-signed.zip build/dist/
./gradlew publish