diff --git a/Dockerfile b/Dockerfile index e2c0b64..4c85e24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ WORKDIR /srv/build VOLUME ["/srv/build/repo/incoming"] -ENTRYPOINT ["./main.sh", "master"] +ENTRYPOINT ["./main.sh"] diff --git a/src/build.npm.sh b/src/build.npm.sh index 5f23c26..e5f9438 100755 --- a/src/build.npm.sh +++ b/src/build.npm.sh @@ -2,13 +2,30 @@ set -e +NODE_VERSION=$1 + apt-get update -apt-get -qq -y --no-install-recommends install curl jq ca-certificates git g++ gcc make clang wget xz-utils python3 sudo +apt-get -qq -y --no-install-recommends install \ + curl \ + jq \ + ca-certificates \ + git \ + g++ \ + gcc \ + make \ + clang \ + wget \ + xz-utils \ + sudo \ + python3-minimal \ + python3-distutils \ + python-is-python3 + mkdir build_node cd build_node/ || exit -wget https://nodejs.org/dist/v17.5.0/node-v17.5.0.tar.xz -tar xf node-v17.5.0.tar.xz -mv node-v17.5.0 node +wget https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION.tar.xz +tar xf node-$NODE_VERSION.tar.xz +mv node-$NODE_VERSION node cd node || exit ./configure make -j4 diff --git a/src/build.sh b/src/build.sh index c8a077c..2480e97 100755 --- a/src/build.sh +++ b/src/build.sh @@ -2,13 +2,7 @@ set -e -#echo "Installing build dependencies (third party)..." -#./install.npm.thirdparty.sh - -echo "Installing build dependencies (npm official source)..." -./build.npm.sh - -cd project +cd "${1:-deltachat-desktop}" #echo "Installing build dependencies (apt)..." #apt-get -qq -y --no-install-recommends install npm cargo > /dev/null diff --git a/src/main.sh b/src/main.sh index f998959..d5ca861 100755 --- a/src/main.sh +++ b/src/main.sh @@ -20,16 +20,38 @@ else echo "Release selected: ${CHECKOUT}" fi +REPO_PATH=deltachat-desktop + echo "Getting the source..." -./getsauce.sh "git" \ +REPO_PATH="$REPO_PATH" ./getsauce.sh "git" \ "${REPO_URL}" \ "${CHECKOUT}" -./build.sh + +NODE_VERSION="v16.14.2" + +echo "Checking if node is already installed..." +if command -v node; then + echo "Node already installed." + node --version +else + echo "Node not installed." + echo "Building node ($NODE_VERSION)..." + ./build.npm.sh $NODE_VERSION + #./install.npm.thirdparty.sh +fi + +echo "Building deltachat-desktop..." +./build.sh "$REPO_PATH" echo "Package(s) deploy..." -DIST_DIR="project/dist" +DIST_DIR="$REPO_PATH/dist" INCOMING_DIR="repo/incoming" READY_SUFFIX=".ready" mkdir -p "${INCOMING_DIR}" -./deploy.sh "${DIST_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" +if [ -d "${DIST_DIR}" ]; then + ./deploy.sh "${DIST_DIR}" "${INCOMING_DIR}" "${READY_SUFFIX}" +else + printf "%s\n" "No dist dir found! Aborting..." + exit 1 +fi